Skip to content
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

Provide a way to defer execution of functions #5691

Closed
justinfagnani opened this issue Oct 5, 2012 · 7 comments
Closed

Provide a way to defer execution of functions #5691

justinfagnani opened this issue Oct 5, 2012 · 7 comments
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-isolate

Comments

@justinfagnani
Copy link
Contributor

It's often a requirement to defer a function: in order to complete a Future asynchronously, or to wait for the browser to paint.

Issues 3356 and 2705 can be resolved with an ability to defer a function.

window.setInterval(0, f) (and therefore new Timer(f, 0)) isn't sufficient because it does not invoke the callback on the current or next event loop, but waits at least 4ms (html5 spec) or longer depending on the browser.

IE 10 is adding setImmediate() to handler this and it can be emulated with postMessage.

GWT allows a command to be deferred either till the end of the current event loop, or to the beginning of the next, which follows layout/paint.

This function should live in the same library as Future so that Future can automatically defer Future.complete()

@justinfagnani
Copy link
Contributor Author

Marked this as blocking #3356.

@lrhn
Copy link
Member

lrhn commented Oct 10, 2012

Added Library-Isolates label.

@DartBot
Copy link

DartBot commented Oct 30, 2012

This comment was originally written by [email protected]


One thing I always liked in GWT was the Scheduler for this:

http://google-web-toolkit.googlecode.com/svn/javadoc/2.0/com/google/gwt/core/client/Scheduler.html

I'm not saying to take that Java class 'as is' - but the functionality / granularity is great.

@DartBot
Copy link

DartBot commented Nov 4, 2012

This comment was originally written by [email protected]


I think this is actually a duplicate of issue #3260.

@dgrove
Copy link
Contributor

dgrove commented Jan 11, 2013

Added Library-Isolate label.

@dgrove
Copy link
Contributor

dgrove commented Jan 11, 2013

Removed Library-Isolates label.

@andersjohnsen
Copy link

We've added 'scheduleMicrotask' to dart:async to do exactly this. See http://api.dartlang.org/docs/bleeding_edge/dart_async.html#scheduleMicrotask.

Note that some implementations still use Timer.run(...) to implement this, thus still delaying the execution unnecessarily long. This is currently being worked on (there are individual bugs for that).


Added Fixed label.

@justinfagnani justinfagnani added Type-Defect area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-isolate labels Oct 15, 2013
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-isolate
Projects
None yet
Development

No branches or pull requests

5 participants