get profile data from client
npm i js-apm
or bundled:
<script src="dist/bundle/js-apm.js"></script>
will expose global Apm
constuctor
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