Name: ember-performance-tracking
Owner: DigitalOcean
Description: null
Forked from: spham92/ember-performance-tracking
Created: 2017-09-07 17:47:17.0
Updated: 2017-09-07 17:47:18.0
Pushed: 2017-09-07 19:01:13.0
Homepage: null
Size: 21
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Ember performance tracking is a lightweight library for getting transition times from start of a transition to the final route.
Installing the library is as easy as:
r install ember-performance-tracking
r g perf-tracking-service perf-tracking-service
Once you finish installing, you will see a service generated in your app folder. This service extends the base class from the addon and gives you access to the transition data once a transition is complete. Make sure to not change the file name.
rt BaseServiceTracking from 'ember-performance-tracking/services/performance-tracking';
rt default BaseServiceTracking.extend({
*
OVERRIDE FUNCTION
@param {Object} transitionData Object containing transition timing data
/
ansitionComplete: function (transitionData) {
// MODIFY HERE
The transitionData contains the destination route name and the destination pathname. The AJAX calls performed between the start and end of the transition will also be included in the resources attribute of the object. The objects in the resources array include the duration and the startTime offset from the navigation start from the performance api.
If the browser supports the performance api, the timings are DOMHighResTimeStamp which is basically in milliseconds, otherwise (new Date()).getTime() is used which is also in milliseconds
destinationRoute: "some-parent.child-route.index",
duration: 7661.005000000002, //DOMHighResTimeStamp (milliseconds)
end: 8364.785000000002, //DOMHighResTimeStamp (milliseconds)
isInitial: true,
resources: [{
duration: 523, //DOMHighResTimeStamp (milliseconds)
name: "http://ajaxHostName.com/resource",
startTime: 772 //DOMHighResTimeStamp (milliseconds)
}, ...
],
start: 703.7800000000001, //DOMHighResTimeStamp (milliseconds)
startTimestamp: 1455168547958, //Timestamp in milliseconds since epoch
url: "/some-parent/child-route/"
This addon is released under the MIT License.