npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ember-performance-tracking

v1.0.0

Published

Track how long your transitions take with ajax calls

Downloads

4

Readme

Ember Performance Tracking

Ember performance tracking is a lightweight library for getting transition times from start of a transition to the final route.

Installation

Installing the library is as easy as:

ember install ember-performance-tracking
ember g perf-tracking-service perf-tracking-service

Basic Usage

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.

import BaseServiceTracking from 'ember-performance-tracking/services/performance-tracking';

export default BaseServiceTracking.extend({
  /**
   * OVERRIDE FUNCTION
   * 
   * @param  {Object} transitionData Object containing transition timing data
   */
  transitionComplete: function (transitionData) {
    // MODIFY HERE
  }
});

Transition Data Example

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

  • duration: Time in milliseconds from the start of the transition to the end of the transition
  • end: Time offset from navigation start from the performance api
  • isInitial: Indicates if the data is for a hard load (downloading html and static assets) or soft load.
  • start: Time offset from navigation start from the performance api
  • startTimestamp: Timestamp in milliseconds of the start of the transition
{
    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/"
}

License

This addon is released under the MIT License.