-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use the promise(fn)
notation
#3
Comments
Given what I discovered in #5, I think this approach should definitely exist. Whether we do deferreds also is a different question, but I'm coming around to a promise constructor idea using this pattern. |
I think if we do go with this as our primary promise creation method, we need to strictly enforce that function Deferred() {
if (!(this instanceof Deferred)) return new Deferred();
var resolver;
var promise = new Promise(function (res) { resolver = res; });
this.resolver = resolver;
this.promise = promise;
} |
@ForbesLindesay Good point about |
We could have a
promise(fn)
method which returns a promise, and calls the function with the resolver for that promise.Advantages
.constructor
property of a promise (see discovery of resolver #5)Disadvantages
function
keywordSummary
I'm very much in favour of this proposal
The text was updated successfully, but these errors were encountered: