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!

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store