@shopify/performance
Advanced tools
@@ -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,3 +9,3 @@ import { onTTFB, onFCP, onFID, onLCP } from 'web-vitals'; | ||
| class Performance { | ||
| constructor() { | ||
| constructor(withCustomNavigation) { | ||
| this.supportsObserver = hasGlobal('PerformanceObserver'); | ||
@@ -28,7 +28,13 @@ this.supportsMarks = hasGlobal('PerformanceMark'); | ||
| }; | ||
| this.withCustomNavigation = withCustomNavigation; | ||
| this.start({ | ||
| timeStamp: 0 | ||
| }); | ||
| withNavigation(this.start.bind(this)); | ||
| if (this.withCustomNavigation) { | ||
| this.withCustomNavigation(this); | ||
| } else { | ||
| withNavigation(this.start.bind(this)); | ||
| } | ||
| if (this.supportsTimingEntries && (!this.supportsDetailedTime || !this.supportsNavigationEntries)) { | ||
@@ -35,0 +41,0 @@ 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 E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CAAK;IAC5B,OAAO,CAAC,aAAa,CAInB;gBAEkB,oBAAoB,CAAC,UAAS,WAAW,KAAK,IAAI,aAAA;IAsJtE,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM;IAM9B,EAAE,CAAC,CAAC,SAAS,MAAM,QAAQ,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC;IA8B3D,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,EAAC,OAAe,EAAC;;KAAK;IAQ1C,KAAK,CAAC,EACJ,SAAiB,EACjB,MAAiC,EACjC,OAAyB,GAC1B;;;;KAAK;IA2BN,MAAM,CAAC,SAAS,SAAQ;IAWxB,MAAM,CAAC,SAAS,SAAQ;IAcxB,OAAO,CAAC,cAAc;IAkBtB,OAAO,CAAC,OAAO;IAUf,OAAO,CAAC,YAAY;IAOpB,OAAO,CAAC,MAAM;CAOf"} |
+1
-1
| { | ||
| "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
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
90269
0.77%1508
0.73%