performance-resource-collector
v0.1.0
Published
frontend performance resource collector
Downloads
2
Readme
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