File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
packages/tracing/src/browser/web-vitals Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change 1414 * limitations under the License.
1515 */
1616
17+ import { getGlobalObject } from '@sentry/utils' ;
18+
1719import { initMetric } from './lib/initMetric' ;
1820import { ReportHandler } from './types' ;
1921
22+ const global = getGlobalObject < Window > ( ) ;
23+
2024interface NavigationEntryShim {
2125 // From `PerformanceNavigationTimingEntry`.
2226 entryType : string ;
@@ -80,7 +84,7 @@ const getNavigationEntryFromPerformanceTiming = (): PerformanceNavigationTiming
8084 // Note: browsers that do not support navigation entries will fall back to using performance.timing
8185 // (with the timestamps converted from epoch time to DOMHighResTimeStamp).
8286 // eslint-disable-next-line deprecation/deprecation
83- const timing = performance . timing ;
87+ const timing = global . performance . timing ;
8488
8589 const navigationEntry : NavigationEntryShim = {
8690 entryType : 'navigation' ,
@@ -105,7 +109,7 @@ export const getTTFB = (onReport: ReportHandler): void => {
105109 try {
106110 // Use the NavigationTiming L2 entry if available.
107111 const navigationEntry =
108- performance . getEntriesByType ( 'navigation' ) [ 0 ] || getNavigationEntryFromPerformanceTiming ( ) ;
112+ global . performance . getEntriesByType ( 'navigation' ) [ 0 ] || getNavigationEntryFromPerformanceTiming ( ) ;
109113
110114 metric . value = metric . delta = ( navigationEntry as PerformanceNavigationTiming ) . responseStart ;
111115
You can’t perform that action at this time.
0 commit comments