Last active
July 23, 2016 19:55
-
-
Save jasonhargrove/48efe4cfa5971e928740516a682eefbf to your computer and use it in GitHub Desktop.
ES7 async function, await and setTimeout
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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