mike-north/ember-perf

View on GitHub
blueprints/ember-perf-initializer/files/app/instance-initializers/__name__.js

Summary

Maintainability
A
0 mins
Test Coverage
export function initialize() {
    // Handle 1.12.x case, where signature is
    //  initialize(instance) {...}
    const instance = arguments[1] || arguments[0];
    const container = !!arguments[1] ? arguments[0] : instance.container;

    let perfService = container.lookup('service:ember-perf');
    perfService.on('transitionComplete', transitionData => {
      // DO SOMETHING WITH TRANSITION DATA
    });
    perfService.on('renderComplete', transitionData => {
      // DO SOMETHING WITH RENDER DATA
    });

}

export default {
  name: '<%= dasherizedModuleName %>-instance',
  initialize
};