11ty / webc

Single File Web Components
MIT License
1.3k stars 36 forks source link

Investigate async generators for streaming #177

Open Zearin opened 1 year ago

Zearin commented 1 year ago

DISCLAIMER: This is the sort of thing that I have only a broad, surface-level understanding of. Please excuse me if I'm barking up the wrong tree. 😉


Ever since I read this best-in-class article about async generators, I have been waiting to see it implemented in the wild. It just looks so powerful!

The original article was later refined into the second section of this chapter.

I recommend reading both, though; they explain concepts using different examples, and sometimes one is a better match for the reader's mental model than the other. (Or, mental models sometimes change, too.)

I don’t think JS engines would have implemented async generators unless it offered some benefit that could not be achieved by using either async functions or generators alone. (Speculating, but still.)