Infinite Scroll using Generators!

Put ES6 generators to some real use.

Disclaimer: No JS libraries or frameworks were created or used while writing this article.

async await is a much simpler construct to make async code look sync.

But then what about generators ? They come in handy when we need to streamify a large input source. So, Infinite scroll.

How the final Infinite Scroll will look like
  1. Maintain the state of offset and fetch the next set of items.
  2. Synchronization of API calls over the network, the response will come out of order often.
  1. Appends the items to the container
  2. Wait for the next emission of the conditional event stream.

No business like the show business!