Function

registerWaiter (context, callback) public

Module: @ember/test

Available since v1.2.0

import { registerWaiter } from '@ember/test';
context
Object
(optional)
callback
Function

This allows ember-testing to play nicely with other asynchronous events, such as an application that is waiting for a CSS3 transition or an IndexDB transaction. The waiter runs periodically after each async helper (i.e. click, andThen, visit, etc) has executed, until the returning result is truthy. After the waiters finish, the next async helper is executed and the process repeats.

For example:

Ember.Test.registerWaiter(function() {
  return myPendingTransactions() == 0;
});

The context argument allows you to optionally specify the this with which your callback will be invoked.

For example:

Ember.Test.registerWaiter(MyDB, MyDB.hasPendingTransactions);

© 2020 Yehuda Katz, Tom Dale and Ember.js contributors
Licensed under the MIT License.
https://api.emberjs.com/ember/2.18/functions/@ember%2Ftest/registerWaiter