Skip to content

Commit 947b15b

Browse files
committed
tests: try without window imports
1 parent 861e79a commit 947b15b

File tree

1 file changed

+4
-4
lines changed
  • packages/browser-utils/src/metrics

1 file changed

+4
-4
lines changed

packages/browser-utils/src/metrics/inp.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,13 @@ import {
55
getCurrentScope,
66
getRootSpan,
77
htmlTreeAsString,
8-
isBrowser,
98
SEMANTIC_ATTRIBUTE_EXCLUSIVE_TIME,
109
SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_UNIT,
1110
SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_VALUE,
1211
SEMANTIC_ATTRIBUTE_SENTRY_OP,
1312
SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,
1413
spanToJSON,
1514
} from '@sentry/core';
16-
import { WINDOW } from '../types';
1715
import type { InstrumentationHandlerCallback } from './instrument';
1816
import {
1917
addInpInstrumentationHandler,
@@ -161,9 +159,11 @@ export const _onInp: InstrumentationHandlerCallback = ({ metric }) => {
161159
export function registerInpInteractionListener(): void {
162160
// Listen for all interaction events that could contribute to INP
163161
const interactionEvents = Object.keys(INP_ENTRY_MAP);
164-
if (isBrowser()) {
162+
// eslint-disable-next-line no-restricted-globals
163+
if (typeof window !== 'undefined') {
165164
interactionEvents.forEach(eventType => {
166-
WINDOW.addEventListener(eventType, captureElementFromEvent, { capture: true, passive: true });
165+
// eslint-disable-next-line no-restricted-globals
166+
window.addEventListener(eventType, captureElementFromEvent, { capture: true, passive: true });
167167
});
168168
}
169169

0 commit comments

Comments
 (0)