performance-resource-collector
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

This script is a tool for collecting frontend metrics.

You should check browser compatibility about PerformanceObserver or use a polyfill before use this.

Install

yarn add performance-resource-collector

Usage

import { initCollector } from 'performance-resource-collector';
 
initCollector({
  callback: (entries) => {
    navigator.sendBeacon("http://metric-collect-service/resources", JSON.stringify(entries))
  },
  onUnsupported: () => {
    console.log('unsupport!');
  },
  onSetUp: () => {
    console.log('collecting performance entries...');
  },
  throttle: 2000,
});

or see example

Readme

Keywords

Package Sidebar

Install

npm i performance-resource-collector

Weekly Downloads

0

Version

0.1.0

License

ISC

Unpacked Size

14.3 kB

Total Files

10

Last publish

Collaborators

  • frezc