PRO RSS Feed
We can communicate between generators and their instances with strategically placed yield keywords. This video will show you how to make it happen based on a simple example.
With one tiny utility function we’ll unlock the full power of generators to make them work well with Promises and thus be the perfect weapon for asynchronous flows in our apps.
We can execute generators from generators, and delegate the iteration control with the yield* keyword.
Yo dawg, I heard you like generators, so I put generators inside your generators.
Generators are iterables, meaning we can easily iterate over the yielded values with a for-of loop. This video demonstrates this based on a simple counter example.
One can throw an error in a generator from the outside with it.throw(). Since all the code inside of a generator is synchronous, we can use the standard try/catch method of handling errors!
ES6 generators make it possible to pause and resume function execution at arbitrary points. This video will introduce you to the basics of generators with the yield keyword.