Skip to content

Instantly share code, notes, and snippets.

@DanielMSchmidt
Last active April 13, 2016 20:38
Show Gist options
  • Save DanielMSchmidt/d0720f7347574d9efcbe1fba8cf15ee5 to your computer and use it in GitHub Desktop.
Save DanielMSchmidt/d0720f7347574d9efcbe1fba8cf15ee5 to your computer and use it in GitHub Desktop.
var Constructor = function() {
this.promise = myPromiseLib();
this.onEventCallback = function(e) {
return this.promise.resolve(e.name);
}.bind(this);
return this;
}
var item = new Constructor();
item.promise.then(function(result) {
return result.name;
}).then(function(resultName) {
return resultName.toUppercase();
})
var Constructor = function() {
this.promise = myPromiseLib();
this.onEventCallback = ({name}) => {
return this.promise.resolve(name);
};
return this;
}
var item = new Constructor();
item.promise
.then(result => result.name)
.then(resultName => resultName.toUppercase());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment