You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Having a reference to itself, allows the generator to yield control flow to other operation, before returning to itself and continue processing.
This is useful.
constcount=newcrank();count.next();// yay!
Without [[construct]] trap for generators this is required:
function*crank(){constmy=yield'MPs EYE BAN ON NEW FOR COROUTINES AS CONSIDERED "HARMFUL"',next=x=>my.next(x),turn=x=>setTimeout(()=>next(x),100);letx=1;while(true)console.log(x=x<12 ? yieldturn(x+1) : yieldturn(1));}constinconvenient=crank();inconvenient.next();// harmful you say?inconvenient.next(inconvenient);// qed
The text was updated successfully, but these errors were encountered:
ljharb
added
the
feature suggestion
Please see https://github.com/tc39/ecma262/blob/HEAD/CONTRIBUTING.md#creating-a-new-proposal
label
Jan 29, 2019
RE: https://github.com/tc39/tc39-notes/blob/master/es7/2015-07/july-28.md#67-new--generatorfunction
Actually you can do this :
Having a reference to itself, allows the generator to yield control flow to other operation, before returning to itself and continue processing.
This is useful.
Without [[construct]] trap for generators this is required:
The text was updated successfully, but these errors were encountered: