Skip to content

Instantly share code, notes, and snippets.

@mitchellporter
Created June 6, 2017 20:51
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mitchellporter/aad26fb3889321d972491637ee4c610d to your computer and use it in GitHub Desktop.
Save mitchellporter/aad26fb3889321d972491637ee4c610d to your computer and use it in GitHub Desktop.
async/await IIFE snippet
(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