Skip to content

Instantly share code, notes, and snippets.

@kg
Last active July 13, 2016 13:14
Show Gist options
  • Save kg/4f48c8a81b810435534d956a50a03449 to your computer and use it in GitHub Desktop.
Save kg/4f48c8a81b810435534d956a50a03449 to your computer and use it in GitHub Desktop.
function PromiseResolver () {
var self = this;
this.promise = new Promise(
function (resolve, reject) {
self.resolve = resolve;
self.reject = reject;
}
);
};
var pr = new PromiseResolver();
window.setTimeout(function () { pr.resolve(1); }, 500);
return pr.promise;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment