Generators in ECMAscript 6 are first-class coroutines that produce encapsulated suspended execution contexts. Whew! Yield values and iterate over them until no more values exist in the generator. We'll talk more about practical use later ;)
This may sound off topic, but up until this video, i've noticed that ecma script 6 looks a lot like python.. any reason or story behind it?
I was following along with the ES6 lessons nicely up to this one. Then........wat?
John Lindquist mentions there will be follow up lessons on practical use cases of Generators. I realize there are whole courses on RxJS, etc but can we see some practical uses of Generators soon?
John Lindquist mentions there will be follow up lessons on practical use cases of Generators. I realize there are whole courses on RxJS, etc but can we see some practical uses of Generators soon?
I'm wondering the same thing. There is an RxJS Observables + Generators lesson by Mr. CycleJS.
I was following along with the ES6 lessons nicely up to this one. Then........wat?
same
lost the thread of the course on this video. I really could have used some sort of practical example of generators.
lost the thread of the course on this video. I really could have used some sort of practical example of generators.
Hey James, generators had me scratching my head for a practical use for a long time. Then I saw them used for redux-sagas. Mind blown! http://joelhooks.com/blog/2016/03/20/build-an-image-gallery-using-redux-saga
Please fix this sound. Twelve is very low volume, then when you come into thirteen it blows your eardrums out !!!
I would also like to see practical use cases of generators.
At 4:38, when I called the first next
with a string, it didn't throw a TypeError for me.
does anyone have a link to his aforementioned 'practical uses' video? cheers
there's a course for generators you might like to watch https://egghead.io/courses/write-simple-asynchronous-code-with-javascript-generators
there's a course for generators you might like to watch https://egghead.io/courses/write-simple-asynchronous-code-with-javascript-generators
Thanks Alex!
I agree with many of the comments above that this chapter is missing information on practical use cases for generators.
Finally a simple explanation of generators. So far I was just confused about the logic and usage. Thanks!