in src/performance/index.ts [62:82]
public getPerf(options: CustomOptionsType) {
this.options = options;
this.perfInfo = {
pagePath: options.pagePath,
serviceVersion: options.serviceVersion,
service: options.service,
}
this.coreWebMetrics = new Proxy({...this.perfInfo, collector: options.collector, useWebVitals: options.useWebVitals}, handler);
this.observeResources();
// trace and report perf data and pv to serve when page loaded
if (document.readyState === 'complete') {
this.getBasicPerf();
} else {
window.addEventListener('load', () => this.getBasicPerf());
}
this.getCorePerf();
window.addEventListener('beforeunload', () => {
this.reportINP();
this.reportResources();
});
}