Created
June 6, 2017 20:51
-
-
Save mitchellporter/aad26fb3889321d972491637ee4c610d to your computer and use it in GitHub Desktop.
async/await IIFE snippet
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
(async () => { | |
const func = () => { | |
return new Promise((resolve, reject) => { | |
setTimeout(() => { | |
resolve('some async result'); | |
}, 5000); | |
}); | |
} | |
const result = await func(); | |
console.log(`result: ${result}`); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment