Function

import { run } from '@ember/runloop';
target
Object
target of method to call
method
Function|String
Method to invoke. May be a function or a string. If you pass a string then it will be looked up on the passed target.
args*
Object
Any additional arguments you wish to pass to the method.
returns
Object
return value from invoking the passed function.

Runs the passed target and method inside of a RunLoop, ensuring any deferred actions including bindings and views updates are flushed at the end.

Normally you should not need to invoke this method yourself. However if you are implementing raw event handlers when interfacing with other libraries or plugins, you should probably wrap all of your code inside this call.

1
2
3
4
5
import { run } from '@ember/runloop';

run(function() {
  // code to be executed within a RunLoop
});