Skip to content

Instantly share code, notes, and snippets.

@jasonhargrove
Last active July 23, 2016 19:55
Show Gist options
  • Save jasonhargrove/48efe4cfa5971e928740516a682eefbf to your computer and use it in GitHub Desktop.
Save jasonhargrove/48efe4cfa5971e928740516a682eefbf to your computer and use it in GitHub Desktop.
ES7 async function, await and setTimeout
export async function test () {
let some = await someThing(3000);
console.log(some);
return some;
}
async function someThing (ms) {
return new Promise(resolve => setTimeout(() => {
resolve(ms)
}, ms));
}
test();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment