3 ms·
Proposal? JavaScript 1.7 introduced generators circa 2006, which I do believe lets you implement something like this (in addition to a bunch of other cool thing
by pmjordan 15y ago
Proposal? JavaScript 1.7 introduced generators circa 2006, which I do believe lets you implement something like this (in addition to a bunch of other cool things).
https://developer.mozilla.org/en/New_in_JavaScript_1.7#Generators https://developer.mozilla.org/en/New_in_JavaScript_1.7#Gener...
Unfortunately, V8 doesn't support generators, as far as I can tell.
- va1en0k 15y agosorry? generators? well, I like generators, but what's your point?
- pmjordan 15y agoyield; Will block execution until the generator is resumed and return control flow to the caller. I haven't actually tried it, but it should be pretty straightforward to wrap a generator function in such a way that it's driven (resumed) by callbacks from async I/O calls.