We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
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
The following reproduces for me on both node 8 and node 10.
let resolve; const promise = new Promise(x => resolve = x); promise.then(() => console.log('task1: promise resolved')); setTimeout(() => { console.log('task1: settimeout'); resolve(); }, 0); setTimeout(() => console.log('task2: settimeout'), 0);
In Web, every setTimeout will be dispatched in a separate task; as a result, the script will always yield:
task1: settimeout task1: promise resolved task2: settimeout
In node, however, the behavior is flaky and every other time I see the following:
task1: settimeout task2: settimeout task1: promise resolved
If this is intended behavior, I didn't find any description in documentation.
This, however, is very unexpected for someone coming from Web to Node.js.
The text was updated successfully, but these errors were encountered:
I believe this is a duplicate of #22257
Sorry, something went wrong.
Awesome. Thanks!
No branches or pull requests
The following reproduces for me on both node 8 and node 10.
In Web, every setTimeout will be dispatched in a separate task; as a result, the script will always
yield:
In node, however, the behavior is flaky and every other time I see the following:
If this is intended behavior, I didn't find any description in documentation.
This, however, is very unexpected for someone coming from Web to Node.js.
The text was updated successfully, but these errors were encountered: