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
dart2js should not use windows.setTimeout with a delay of 0 to implement Future.immediate #8757
Comments
This comment was originally written by @bp74 IE10 supports performance.setImmediate(..) which is not a standard yet and not supported by Chrome and Firefox. But it would be the perfect solution in the future. |
Yeah, I think "window.setImmediate" in dart:html is what you want. It will do the best thing that is available in the browser, in priority order:
(you can find the impl by searching for "_MicrotaskScheduler.best" under sdk/lib/html) |
Thank you, John! |
Added this to the Later milestone. |
Added TriageForM5 label. |
Removed TriageForM5 label. |
Removed this from the Later milestone. |
Removed Oldschool-Milestone-Later label. |
The code for microtasks doesn't use setTimeout anymore. |
Using windows.setTimeout with a delay of 0 doesn't do what we expect, as the next timer event may occur much later.
MDN recommends using windows.postMessage, see https://developer.mozilla.org/en/docs/DOM/window.setTimeout#Minimum_delay_and_timeout_nesting
This poses another problem as whatever message is posted might confuse user code.
It looks like a better alternative is to use MessageChannel, or an iframe.
The text was updated successfully, but these errors were encountered: