Skip to content

Instantly share code, notes, and snippets.

@otarim
Last active November 29, 2015 04:54
Show Gist options
  • Select an option

  • Save otarim/e9df7e83334dc14b2758 to your computer and use it in GitHub Desktop.

Select an option

Save otarim/e9df7e83334dc14b2758 to your computer and use it in GitHub Desktop.
'use strict'
var T = function() {
}
var as = async function() {
return new Promise(function(resolve, reject) {
setTimeout(function() {
resolve(1000)
}, 1000)
})
}
T.prototype = {
constructor: T,
init: async function() {
this.xxoo = await as()
return this
},
getXXOO: function() {
console.log(this.xxoo)
}
}
var t = new T
;
(async function() {
(await t.init()).getXXOO()
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment