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

ng-rum

v0.1.6

Published

A tool to do RUM (Real User Monitoring) compatible with angular2+

Downloads

38

Readme

NG-RUM

NG-RUM proposes methods to help monitor the real user performance of your web application. (compatible with Angular2+)

Notes

  • This project is still under development
  • Contributions are welcome
  • Pull request are accepted

Installation

In angular 2+

Add the package

In your package.json add the line:

"ng-rum": "^0.1.2"

Install the node modules of your application

npm install

Call ng-rum

  • Imports the library
import * as RUM from 'ng-rum';
  • Calls the method (Gets the data about the navigator, the different times specified in params and the user) You can add the following calls where you think they are the most judicious. Personally, I put them in the main app component in the hook ngAfterViewChecked() :
console.log(RUM.getData({
  webPageLoadTime: true,
  webPageRenderTime: true,
  entriesLoadTime: true,
  measures: true
  }, {
      name: 'admin',
      role: 'admin'
}));
  • Sends the data to an URL (Sends data to the url URL, about the navigator, the different times specified in params and the user, using post method)
RUM.sendData(URL, {
  webPageLoadTime: true,
  webPageRenderTime: true,
  entriesLoadTime: true,
  measures: true
  }, {
      name: 'admin',
      role: 'admin'
}));

Start your application

npm run start

In your favorite browser's console, you should see something link that: (the time are in ms)

{
  "href": "http://localhost:4200/patrimoine",
  "navigator": {
    "appCodeName": "Mozilla",
    "appName": "Netscape",
    "appVersion": "5.0 (Windows)",
    "buildID": "20180128191252",
    "cookieEnabled": true,
    "language": "fr",
    "mimeTypes": {},
    "onLine": true,
    "oscpu": "Windows NT 10.0; Win64; x64",
    "platform": "Win64",
    "plugins": {},
    "product": "Gecko",
    "productSub": "20100101",
    "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:58.0) Gecko/20100101 Firefox/58.0",
    "vendor": "",
    "vendorSub": ""
  },
  "times": {
    "webPageLoadTime": 5273,
    "webPageRenderTime": 4516,
    "entriesLoadTime": {
      "document": 739.5403741612078,
      "http://localhost:3000/json/pays": 341.6426377923899,
      "http://localhost:3000/json/lignes": 398.03157115105523,
      "http://localhost:3000/json/gares": 440.0691856536405,
      "http://localhost:4200/sockjs-node/info?t=1518086900287": 279.35986860122966
    },
    "measures": {
      "header": 117.53999999999996,
      "app": 121.44000000000005
    }
  },
  "user": {
    "name": "admin",
    "role": "admin"
  }
}

Configuration

getData()

RUM.getData({ // The parameters
    webPageLoadTime: true, // Set to true if you want to get the web page load time
    webPageRenderTime: true, // Set to true if you want to get the web page render time
    entriesLoadTime: true, // Set to true if you want to get the load time of your application's entries 
    measures: true, // Set to true if you want to get our personalize measures (see below)
    }, { // Optionnal: specify a user
      name: 'admin', // unspecified by default
      role: 'admin' // unspecified by default
    }));

Personalize measures

You can measure the load time of the component you want.

Start a measure

I advise you to put this function on the ngOnInit hook

RUM.startMeasure('${THE_MEASURE_NAME}');

Stop a measure

I advise you to put this function on the ngAfterViewChecked hook

RUM.stopMeasure('${THE_MEASURE_NAME}');

Reset the measures

I advise you to call this function when your application change route

RUM.stopMeasures();

TODO