Sha256: 8ef18155729a12dcb2b02fc2a61518ea934ccd7afd555aa56079ad969b8a4c8e

Contents?: true

Size: 774 Bytes

Versions: 3

Compression:

Stored size: 774 Bytes

Contents

export const callbacks = [];

/**
  Used to register callbacks to be fired whenever `App.injectTestHelpers`
  is called.

  The callback will receive the current application as an argument.

  Example:

  ```javascript
  import $ from 'jquery';

  Ember.Test.onInjectHelpers(function() {
    $(document).ajaxSend(function() {
      Test.pendingRequests++;
    });

    $(document).ajaxComplete(function() {
      Test.pendingRequests--;
    });
  });
  ```

  @public
  @for Ember.Test
  @method onInjectHelpers
  @param {Function} callback The function to be called.
*/
export function onInjectHelpers(callback) {
  callbacks.push(callback);
}

export function invokeInjectHelpersCallbacks(app) {
  for (let i = 0; i < callbacks.length; i++) {
    callbacks[i](app);
  }
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
discourse-ember-source-3.6.0.0 dist/es/ember-testing/lib/test/on_inject_helpers.js
discourse-ember-source-3.5.1.1 dist/es/ember-testing/lib/test/on_inject_helpers.js
discourse-ember-source-3.5.1.0 dist/dist/es/ember-testing/lib/test/on_inject_helpers.js