Skip to content

Instantly share code, notes, and snippets.

@amk221
Last active April 5, 2016 16:44
Show Gist options
  • Save amk221/62dbcf21b2d28a8fe3f6 to your computer and use it in GitHub Desktop.
Save amk221/62dbcf21b2d28a8fe3f6 to your computer and use it in GitHub Desktop.
import Router from 'ember-router';
import on from 'ember-evented/on';
import { scheduleOnce } from 'ember-runloop';
const { newrelic } = window;
const { timing } = window.performance;
export default Router.extend({
location: config.locationType,
_start: on('didTransition', function() {
scheduleOnce('afterRender', this, '_finish');
}),
_finish() {
let seconds = (Date.now() - timing.domComplete) / 1000;
newrelic.addPageAction(this.get('url'), seconds);
}
});
@Dhaulagiri
Copy link

I'm curious how you've found this in practice? After initial render, timing.domComplete never changes even if you navigate to another page so this seems like a skewed metric?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment