Generator functions can yield for a moment, and then continue execution.
It goes great with coroutines and promises. Let’s adopt by examples:
First: Synchronous iteration of infinite sequence
Second: Asynchronous iteration of finite sequence
Third: Asynchronous sequential process of items
Fourth: Asynchronous process sequence until breaks
What do you think about last example?
Do you know how to deal with asynchronous iteration of infinite sequence?
Thanks for your comments.