-
Notifications
You must be signed in to change notification settings - Fork 46
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
New principle: A Promise represents completion or a value, not a callback (#342) #496
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This LGTM. Time to ask the rest of the TAG to review.
Thanks @martinthomson! I appear to be unable to add reviewers in this repo, so hopefully there's a process for that? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall this seems a bit esoteric, and I agree with @jyasskin that the title as stated is not always true. I think the examples need some work to establish what should or shouldn't be done, otherwise this principle only makes sense to those who already understand it.
Co-authored-by: Lea Verou <[email protected]>
Feedback incorporated. Thanks! |
We could also shorten it further to: "A Promise represents completion, not a callback" — thoughts? |
Co-authored-by: Harald Alvestrand <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this. I think that the one thing that might be added
If an API depends on setting up temporary conditions then invoking the caller,
that is a good reason to use a callback rather than a promise.
@LeaVerou does this look better? |
Fixes #342.
Preview | Diff