Closed
Description
This issue was originally filed by [email protected]
If you want to defer execution of some function to a later turn of the event queue, you have to use Timer (from dart:io) on the VM and window.setTimeout (from dart:html) in the browser.
Now there is a bug to move Timer from dart:io to dart:core (and I think this should definitely be done), but using timer with zero timeout for deferring execution is quite inconvenient. I suggest to add a function like 'nextTick' to dart:core, modeled after Node.js's API (see http://nodejs.org/api/process.html#process_process_nexttick_callback).
- It's more convenient.
- The API would be the same in both environments.
- As Node guys point out, it can be implemented much more efficiently (which apparently only applies to the VM, it would probably still be compiled to window.setTimeout for the browser).
I'm not exactly sure about the name, maybe 'deferExecution' or 'nextTurn' would be better, but I'll leave this decision up to you.