Skip to content

Instantly share code, notes, and snippets.

@trygve-lie
Created February 9, 2018 12:15
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 trygve-lie/f07b517739d8be03892e92cc4068f2a1 to your computer and use it in GitHub Desktop.
Save trygve-lie/f07b517739d8be03892e92cc4068f2a1 to your computer and use it in GitHub Desktop.
async.constructor.js
class Foo {
constructor(numb) {
this.numb = numb;
}
then(success, fail) {
setTimeout(() => {
success(this.numb);
}, 500);
}
}
async function main() {
const n = await new Foo(42);
console.log(n);
};
main();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment