Skip to content
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

Adapters needing fulfilled(Value) and rejected(reason) methods #4

Closed
ForbesLindesay opened this issue Nov 8, 2012 · 4 comments
Closed

Comments

@ForbesLindesay
Copy link
Member

Couldn't these just be implimented from pending and tested that way, reducing the number of methods to be implemented in adapters:

exports.fulfilled = function (value) {
  let {promise, fulfill} = exports.pending();
  fulfill(value);
  return promise;
};

exports.rejected= function (value) {
  let {promise, reject} = exports.pending();
  reject(value);
  return promise;
};

(obviously you'd need to convert that to ES5 😄)

@domenic
Copy link
Member

domenic commented Nov 8, 2012

You're right, of course. The only objection is that promise libs might not get as much test coverage, if their create-fulfilled and create-rejected functions don't internally work by creating a pending first. I could go either way.

@briancavalier
Copy link
Member

Can/should we provide default implementations for fulfilled and rejected for adapters that don't explicitly provide them? I.e. but still allow an adapter to provide them if it wants to?

@domenic
Copy link
Member

domenic commented Nov 9, 2012

Ooh, I kind of like that idea. Get better coverage if you want it, but not necessary.

@ForbesLindesay
Copy link
Member Author

I like that too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants