Function

Module: @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. Please note, when called within an existing loop, no return value is possible.

If no run-loop is present, it creates a new one. If a run loop is present it will queue itself to run on the existing run-loops action queue.

Please note: This is not for normal usage, and should be used sparingly.

If invoked when not within a run loop:

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

join(function() {
  // creates a new run-loop
});

Alternatively, if called within an existing run loop:

1
2
3
4
5
6
7
8
9
10
import { run, join } from '@ember/runloop';

run(function() {
  // creates a new run-loop

  join(function() {
    // joins with the existing run-loop, and queues for invocation on
    // the existing run-loops action queue.
  });
});