Welcome to Async Generators in JavaScript

preview_player
Показать описание

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

Damn you have a way of explaining stuff that's just crystal clear. Very nice! And thanks for diving into these more advanced aspects of the language!

tichopad
Автор

Seriously this was fucking awesome! Very curious to see you take things another layer deeper!

matthewvaccaro
Автор

Async iterators like regular iterators are best used when you have a situation where you want to write a function that loops over a collection and executes some generic code, but also needs to offer the possibility to run custom code as well. The solution is having that custom code be a callback and passing it to said function. Iterators (async or not) make it possible to achieve the same purpose without the callback by allowing access to the yielded values using a for-loop after the generic code is executed. The result is a linear and cleaner code!

parlor
Автор

This came in my recommended at just the right time. I was reading documentation on a framework I love that uses this pattern in an example and this was the first time I’ve encountered a generator. Great video, great explanation. Thank you

JuicyBenji
Автор

I'm more impressed by how good you are at pronouncing "iterator" back to back lol great vid btw

smash
Автор

Thank you for a super video. Press keeps posting! You have been missed👌

Fullflexno
Автор

This is a great explanation, you're a very skilled teacher :D by the way do you have your neovim config available somewhere? It's a great setup.

thinkpad
Автор

Apparently I have watched the video and even dropped a like and I just realize that I have no idea when but this was released 3 days ago

i would love to been taught about how normal generators can yield promises and the benefit of of such exotic thing when compared to the more normal asyncGenerator that people use normally when they have promises

Luxcium
Автор

love the content. Nice job. Keep it up

ionelCristianLupu_
Автор

Also great for reading streams of server sent events. But, be careful using this in the client side. You’ll need to have a special transpiler plugin for your build system to be browser compatible.

dave
Автор

really great video about generators. thank you

devKev
Автор

Could you tell me please what plugin you are using that highlights errors directly in the code?

glazevolda
Автор

It would be nice if you could explain to the viewer why the people behind ES/JS decided to go with the sneaky asterisk for generators. Because:

async function* bla() { ... }

Should have been:

async generator bla() { ... }

Or even:

async generator function bla() { ... }

Or even better: any function would become a generator when you use `yield` and you don't have to mark a function as being a generator.

The powers that be decided that JS has to be backwards compatible or something, and that's why it wouldn't work. One solution would've been to make JS files "versioned" in a sense (like writing /* ES6 */ on top of your file or something–a feature toggle), but they decided against that, too.

I think it pollutes the ES/JS language by having weird nonsense like this, and doesn't help its already suffering reputation as a weird language.

mahadevovnl
join shbcf.ru