Skip to content

Instantly share code, notes, and snippets.

@bterlson
Created June 5, 2015 19:04
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 bterlson/6ce9503b37685746ef27 to your computer and use it in GitHub Desktop.
Save bterlson/6ce9503b37685746ef27 to your computer and use it in GitHub Desktop.
Async constructors?
async function Person() {
this.name = await getName();
}
// seems weird-ish.
var p = new Person();
p.then(person => console.log(person.name));
// but seems better in another async function
async function CreatePerson() {
var person = await new Person();
// ...
return person;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment