Ember.run.later()

later (target, method, args*, wait) *public

Defined in packages/ember-metal/lib/run_loop.js:311

Invokes the passed target/method and optional arguments after a specified period of time. The last parameter of this method must always be a number of milliseconds.

You should use this method whenever you need to run some action after a period of time instead of using setTimeout(). This method will ensure that items that expire during the same script execution cycle all execute together, which is often more efficient than using a real setTimeout.

run.later(myContext, function() {
  // code here will execute within a RunLoop in about 500ms with this == myContext
}, 500);

Parameters:

target [Object]
target of method to invoke
method Function|String
The method to invoke. If you pass a string it will be resolved on the target at the time the method is invoked.
args* [Object]
Optional arguments to pass to the timeout.
wait Number
Number of milliseconds to wait.

Returns:

*
Timer information for use in cancelling, see `run.cancel`.
doc_EmberJs
2016-11-30 16:51:40
Comments
Leave a Comment

Please login to continue.