Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- async function soasync() {return 1;}
- function* sogen()
- {
- var v: number | undefined = undefined;
- let response = soasync();
- // const callback = yield;
- response.then((x)=>v=x);
- // examples of other things you can do
- setTimeout(yield, 2000);
- return v;
- }
- (function(){
- const gen = sogen();
- console.log(`${gen.next(gen.next).value}`);
- // .next().next().value
- }())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement