BOOMR.plugins. Ember


The Ember plugin allows you to automatically monitor Single Page App (SPA) navigations for Ember.js websites.

Note: This plugins requires the BOOMR.plugins.SPA and BOOMR.plugins.AutoXHR plugins.

For details on how Boomerang Single Page App instrumentation works, see the BOOMR.plugins.SPA documentation.

For information on how to include this plugin, see the Building tutorial.

Compatibility

  • Ember.js 1.x

Note: For Ember.js 2.x, use the BOOMR.plugins.History plugin.

Ember-CLI is not currently supported.

Beacon Parameters

This plugin does not add any additional beacon parameters beyond the BOOMR.plugins.SPA plugin.

Usage

First, include the BOOMR.plugins.SPA, BOOMR.plugins.Ember and BOOMR.plugins.AutoXHR plugins. See Building for details.

Next, you need to also "hook" Boomerang into the Ember.js lifecycle events.

Add the following code to the end of your route definitions, substituting App for your Ember app.

Example:

function hookEmberBoomerang() {
  if (window.BOOMR && BOOMR.version) {
    if (BOOMR.plugins && BOOMR.plugins.Ember) {
      BOOMR.plugins.Ember.hook(App);
    }
    return true;
  }
}

if (!hookEmberBoomerang()) {
  if (document.addEventListener) {
    document.addEventListener("onBoomerangLoaded", hookEmberBoomerang);
  }
  else if (document.attachEvent) {
    document.attachEvent("onpropertychange", function(e) {
      e = e || window.event;
      if (e && e.propertyName === "onBoomerangLoaded") {
        hookEmberBoomerang();
      }
    });
  }
}

Methods


disable()

Disables the Ember plugin

Returns:

BOOMR.plugins.Ember The Ember plugin for chaining


enable()

Enables the Ember plugin

Returns:

BOOMR.plugins.Ember The Ember plugin for chaining


hook($rootScope [, hadRouteChange] [, options])

Hooks Boomerang into the Ember.js lifecycle events

Parameters:

Name Type Argument Description
$rootScope object

Ember.js router

hadRouteChange boolean <optional>

Whether or not there was a route change event prior to this hook() call

options object <optional>

Options

Returns:

BOOMR.plugins.Ember The Ember plugin for chaining


is_complete()

This plugin is always complete (ready to send a beacon)

Returns:

Type: boolean

true