JavaScript Generators

preview_player
Показать описание
Learn about JavaScript Generators and how to use them to write asynchronous code in a synchronous fashion.

Рекомендации по теме
Комментарии
Автор

For those who don't know what the done is in ( {value: somevalue, done:false} ) generator returned object:

It is just a property to let you know if there are any more elements to iterate over or not. It will return true if iterator is at the end of elements are no more elements are there to return and false if there are still elements left to be iterated.

wolfteamUpdates
Автор

Hey Kyle, just wanted to say thanks for the awesome vids. I've watched a lot of them. I shared this one on Reddit to hopefully get you some more love. Keep it up. They are awesome. Love the simple format.

TheInfamousButt
Автор

Oh, just figured out, in the output, the second parameter, "done", as in { value: "grizzly", done: false }, has nothing to do with the "return 'done'" in the function body. :)

treenopie
Автор

Thanks for this video. I appreciate the explanation along with the examples. I finally understand what's going on inside generator functions.

michelefernandez
Автор

Great presentation! simple, clear and short!

wenastudi
Автор

Thanks for explaining generators. They are awesome. I use it with bluebird promise.coroutine to write my code in synchronous way.

SumitJain
Автор

Great tutorials buddy. About to do server less stack with JavaScript. Thanks

mikiec
Автор

i was staring at this run function for an hour and finally understood it.

paroxyzm
Автор

Third video by you I watched. Again: Fantastic! Time to subscribe!

RobertWildling
Автор

Do you think you can start a project that's more complex? A full production site for example?

OurielOttaviani
Автор

The result of yield 'grizzly' is not gonna be assigned to kind?

piq-dgvz
Автор

@5:55, how does `kind` become bound to 'ferocious'...? So after the first bear.next() call, `var kind = ` is left hanging undefined until the next call...? If you pass in a list of arguments, would `kind` become an array or something?

HonestOntario
Автор

What atom package are you using to enable the dots and the return mark at the end of each line? Any other packages to recommend? Thanks!

francogb
Автор

one thing I was expecting with

var kind = yield 'grizzly'
yield kind + ' polar'

was it will print 'grizzly polar ' . I was also not sure how the generators are accepting the values .
Probably due to new to node :) .

Thank you for the videos.

HariKT
Автор

Just realized how works your 'run' function. I think, you missed to explain very important thing that 'yield' always immediately returns object(let's call it 'singleObject'), even if async operation hasn't completed yet. but when async operation completed then generator append some data to value property of 'singleObject'. I doesn't check it, it's only my own speculation, but I think it is actualy.

finmonster
Автор

how come yield does not return anything in first example but yield returns content of the file in second example?? In first example you had to pass 'ferocious' to assign value to kind. but in second example you get the value in contents variable

saransh
Автор

Do you have your bash_profile posted anywhere? Looks nice.

hatben
Автор

What would happen inside the run function if the callback had more than two parameters?
Thanks

tutas
Автор

If generators are available in es2015 then why don't you use let instead of var?

paroxyzm
Автор

What font is he using? It's the default one on OSX right? What's it called?

needlessoptions