js-apm
TypeScript icon, indicating that this package has built-in type declarations

0.0.8 • Public • Published

Build Status

Performance monitoring for web app

get profile data from client

Installation

npm i js-apm

or bundled:

<script src="dist/bundle/js-apm.js"></script>

will expose global Apm constuctor

Usage

import Apm from "js-apm";

const apm = new Apm(window);
const data = apm.getGeneralInfo();

where data is:

export default class GeneralInfo {
    userAgent: string;
    connection?: Connection;
    timing?: Timing;
}

declare class Connection {
    type?: "bluetooth" | "none" | "unknown" | "cellular" | "ethernet" | "mixed" | "other" | "wifi" | "wimax" | undefined;
    effectiveType?: "2g" | "3g" | "4g" | "slow-2g" | undefined;
    downlinkMax?: number | undefined;
    downlink?: number | undefined;
    rtt?: number | undefined;
    saveData?: boolean | undefined;
}

declare class Timing {
    domComplete: bigint;
    domContentLoadedEventEnd: bigint;
    domContentLoadedEventStart: bigint;
    domInteractive: bigint;
    loadEventEnd: bigint;
    loadEventStart: bigint;
    redirectCount: bigint;
    unloadEventEnd: bigint;
    unloadEventStart: bigint;
}

Connection is serializable version of NetworkInformation
And Timing is like PerformanceNavigationTiming, but with integer values for sake of serialization

Readme

Keywords

none

Package Sidebar

Install

npm i js-apm

Weekly Downloads

2

Version

0.0.8

License

MIT

Unpacked Size

19.7 kB

Total Files

20

Last publish

Collaborators

  • the-toster