Skip to content

Instantly share code, notes, and snippets.

@bitbonsai
Last active December 19, 2018 07:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bitbonsai/d41424e7aff87c32a048eae943fe7836 to your computer and use it in GitHub Desktop.
Save bitbonsai/d41424e7aff87c32a048eae943fe7836 to your computer and use it in GitHub Desktop.
// or even better: https://blog.risingstack.com/mastering-async-await-in-nodejs/
// https://github.com/iagodahlem/clima-cli/blob/master/src/utils/weather.js
// https://github.com/axios/axios
async function f() {
let result = await e(1500);
let output = await d(result);
console.log(output);
}
async function e (delay) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve(c());
}, delay || 1000);
})
}
function c () {
return 'a ordem do dia é: '
}
function d (str) {
return str + 'promessas'
}
f();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment