@shopify/performance
Advanced tools
Comparing version
@@ -13,3 +13,3 @@ 'use strict'; | ||
class Performance { | ||
constructor() { | ||
constructor(withCustomNavigation) { | ||
this.supportsObserver = utilities.hasGlobal('PerformanceObserver'); | ||
@@ -32,7 +32,13 @@ this.supportsMarks = utilities.hasGlobal('PerformanceMark'); | ||
}; | ||
this.withCustomNavigation = withCustomNavigation; | ||
this.start({ | ||
timeStamp: 0 | ||
}); | ||
utilities.withNavigation(this.start.bind(this)); | ||
if (this.withCustomNavigation) { | ||
this.withCustomNavigation(this); | ||
} else { | ||
utilities.withNavigation(this.start.bind(this)); | ||
} | ||
if (this.supportsTimingEntries && (!this.supportsDetailedTime || !this.supportsNavigationEntries)) { | ||
@@ -39,0 +45,0 @@ utilities.withTiming(({ |
@@ -9,2 +9,3 @@ import type { Navigation } from './navigation'; | ||
export declare class Performance { | ||
private withCustomNavigation?; | ||
readonly supportsObserver: boolean; | ||
@@ -26,3 +27,3 @@ readonly supportsMarks: boolean; | ||
private eventHandlers; | ||
constructor(); | ||
constructor(withCustomNavigation?: ((perf: Performance) => void) | undefined); | ||
mark(stage: string, id: string): void; | ||
@@ -29,0 +30,0 @@ on<T extends keyof EventMap>(event: T, handler: EventMap[T]): () => boolean; |
{ | ||
"name": "@shopify/performance", | ||
"version": "4.1.0", | ||
"version": "4.2.0", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "description": "Primitives for collecting browser performance metrics", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
90269
0.77%1508
0.73%