There are a lot of edge cases to handle when creating a library like that and I cannot see them dealt with in this library.
More than three years ago I created in-viewport and have perfected it since. https://github.com/vvo/in-viewport it's used on fortune 500 websites along with my lazyloader (https://github.com/vvo/lazyload).