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 14
14
* limitations under the License.
15
15
*/
16
16
17
+ import { getGlobalObject } from '@sentry/utils' ;
18
+
17
19
import { initMetric } from './lib/initMetric' ;
18
20
import { ReportHandler } from './types' ;
19
21
22
+ const global = getGlobalObject < Window > ( ) ;
23
+
20
24
interface NavigationEntryShim {
21
25
// From `PerformanceNavigationTimingEntry`.
22
26
entryType : string ;
@@ -80,7 +84,7 @@ const getNavigationEntryFromPerformanceTiming = (): PerformanceNavigationTiming
80
84
// Note: browsers that do not support navigation entries will fall back to using performance.timing
81
85
// (with the timestamps converted from epoch time to DOMHighResTimeStamp).
82
86
// eslint-disable-next-line deprecation/deprecation
83
- const timing = performance . timing ;
87
+ const timing = global . performance . timing ;
84
88
85
89
const navigationEntry : NavigationEntryShim = {
86
90
entryType : 'navigation' ,
@@ -105,7 +109,7 @@ export const getTTFB = (onReport: ReportHandler): void => {
105
109
try {
106
110
// Use the NavigationTiming L2 entry if available.
107
111
const navigationEntry =
108
- performance . getEntriesByType ( 'navigation' ) [ 0 ] || getNavigationEntryFromPerformanceTiming ( ) ;
112
+ global . performance . getEntriesByType ( 'navigation' ) [ 0 ] || getNavigationEntryFromPerformanceTiming ( ) ;
109
113
110
114
metric . value = metric . delta = ( navigationEntry as PerformanceNavigationTiming ) . responseStart ;
111
115
You can’t perform that action at this time.
0 commit comments