Skip to content

Instantly share code, notes, and snippets.

@sukima
Created December 13, 2018 19:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sukima/17e52b6ef3de7b85f42b74c2a21ebed7 to your computer and use it in GitHub Desktop.
Save sukima/17e52b6ef3de7b85f42b74c2a21ebed7 to your computer and use it in GitHub Desktop.
ember-perf broken
import instanceInitializer from '../instance-initializers/monitor-perf';
var EMBER_VERSION_REGEX = /^([0-9]+)\.([0-9]+)\.([0-9]+)(?:(?:\-(alpha|beta)\.([0-9]+)(?:\.([0-9]+))?)?)?(?:\+(canary))?(?:\.([0-9abcdef]+))?(?:\-([A-Za-z0-9\.\-]+))?(?:\+([A-Za-z0-9\.\-]+))?$/;
/**
* VERSION_INFO[i] is as follows:
*
* 0 complete version string
* 1 major version
* 2 minor version
* 3 trivial version
* 4 pre-release type (optional: "alpha" or "beta" or undefined for stable releases)
* 5 pre-release version (optional)
* 6 pre-release sub-version (optional)
* 7 canary (optional: "canary", or undefined for stable releases)
* 8 SHA (optional)
*/
var VERSION_INFO = EMBER_VERSION_REGEX.exec(Ember.VERSION);
export function initialize() {
const application = arguments[1] || arguments[0];
const registry = !!arguments[1] ? arguments[0] : application.registry;
var isPre111 = parseInt(VERSION_INFO[1], 10) < 2 && parseInt(VERSION_INFO[2], 10) < 12;
const container = application.__container__;
if (isPre111) {
// For versions before 1.12.0, we have to call the instanceInitializer
instanceInitializer.initialize(registry, application);
}
}
export default {
name: 'monitor-perf',
initialize: initialize,
after: 'ember-perf-setup'
};
export function initialize(appInstance) {
// Must use appInstance per [issue #143](https://github.com/mike-north/ember-perf/issues/143)
let perfService = appInstance.lookup('service:ember-perf');
perfService.on('transitionComplete', transitionData => {
console.log('transitionComplete', transitionData);
});
perfService.on('renderComplete', transitionData => {
console.log('renderComplete', transitionData);
});
}
export default {
name: 'monitor-perf-instance',
initialize
};
import EmberRouter from '@ember/routing/router';
import config from './config/environment';
const Router = EmberRouter.extend({
location: 'none',
rootURL: config.rootURL
});
Router.map(function() {
this.route('foo');
this.route('bar');
this.route('baz');
});
export default Router;
<h1>Welcome to {{appName}}</h1>
{{link-to "Index" "index"}} |
{{link-to "Foo" "foo"}} |
{{link-to "Bar" "bar"}} |
{{link-to "Baz" "baz"}}
{
"version": "0.15.1",
"EmberENV": {
"FEATURES": {}
},
"ENV": {
"emberPerf": {
"injectionFactories": []
}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js",
"ember": "3.4.3",
"ember-template-compiler": "3.4.3",
"ember-testing": "3.4.3"
},
"addons": {
"ember-data": "3.4.2",
"ember-perf": "0.2.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment