Skip to content

Instantly share code, notes, and snippets.

@pi0
Created January 12, 2017 06:51
Show Gist options
  • Save pi0/dacf02ac2af79b3b53094770d0e91c15 to your computer and use it in GitHub Desktop.
Save pi0/dacf02ac2af79b3b53094770d0e91c15 to your computer and use it in GitHub Desktop.
Node 7.4 Async/Await
node --harmony test
function await_me() {
return new Promise((resolve,reject)=> {
setTimeout(()=>{
console.log("After some time");
resolve();
},1000);
})
}
async function test() {
console.log("A");
await await_me();
console.log("B");
}
test();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment