Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

regenerator 貌似也支持async和await #9

Open
i5ting opened this issue Dec 11, 2015 · 2 comments
Open

regenerator 貌似也支持async和await #9

i5ting opened this issue Dec 11, 2015 · 2 comments

Comments

@i5ting
Copy link
Contributor

i5ting commented Dec 11, 2015

http://facebook.github.io/regenerator/

@magicdawn
Copy link

是啊

function sleep(ms){
  return new Promise((resolve, rehect) => {
    setTimeout(resolve, ms);
  });
}

async function demoAsync(){
  console.log('now 1 %s', Date.now());
  await sleep(1000);
  console.log('now 2 %s', Date.now());
}

demoAsync();

image

@magicdawn
Copy link

reject

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants