We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
We've had the discussion and accepted that Promises/A+ promises are always asynchronous for then but what about for calls to resolve
then
resolve
let {promise, resolve} = defer(); console.log(1); promise.then(() => console.log(4)); console.log(2); resolve(null); console.log(3);
If resolve is allowed to be synchronous, this could result in:
1 2 4 3
But if it must be asynchronous then it must result in
1 2 3 4
Because of the restrictions of Promises/A+ it can never result in
1 4 2 3
So what's it to be? Do we force asynchronous behavior?
The text was updated successfully, but these errors were encountered:
Very interesting, thanks for bringing this up! My first instinct is that synchronicity would be bizarre. But, not based on anything concerete yet.
Let's try this similar scenario:
let {promise, resolve} = defer(); console.log(1); resolve(null); promise.then(() => console.log(4)); console.log(2); console.log(3);
The only thing this can be, by Promises/A+, is
To me it seems weird that the output would change depending on whether you hooked up the then before or after the resolve.
Sorry, something went wrong.
Another question is how that plays with 'synchronous inspection'.
No branches or pull requests
We've had the discussion and accepted that Promises/A+ promises are always asynchronous for
then
but what about for calls toresolve
If resolve is allowed to be synchronous, this could result in:
But if it must be asynchronous then it must result in
Because of the restrictions of Promises/A+ it can never result in
So what's it to be? Do we force asynchronous behavior?
The text was updated successfully, but these errors were encountered: