Skip to content

Commit

Permalink
s/self/WINDOW
Browse files Browse the repository at this point in the history
  • Loading branch information
Lms24 committed Nov 22, 2024
1 parent 5aea7f1 commit 2803e51
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion packages/browser-utils/src/metrics/web-vitals/getINP.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* limitations under the License.
*/

import { WINDOW } from '../../types';
import { bindReporter } from './lib/bindReporter';
import { initMetric } from './lib/initMetric';
import { DEFAULT_DURATION_THRESHOLD, estimateP98LongestInteraction, processInteractionEntry } from './lib/interactions';
Expand Down Expand Up @@ -57,7 +58,7 @@ export const INPThresholds: MetricRatingThresholds = [200, 500];
*/
export const onINP = (onReport: (metric: INPMetric) => void, opts: ReportOpts = {}) => {
// Return if the browser doesn't support all APIs needed to measure INP.
if (!('PerformanceEventTiming' in self && 'interactionId' in PerformanceEventTiming.prototype)) {
if (!('PerformanceEventTiming' in WINDOW && 'interactionId' in PerformanceEventTiming.prototype)) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@
* limitations under the License.
*/

import { WINDOW } from '../../../types';

export const getNavigationEntry = (): PerformanceNavigationTiming | void => {
const navigationEntry =
self.performance && performance.getEntriesByType && performance.getEntriesByType('navigation')[0];
WINDOW.performance && WINDOW.performance.getEntriesByType && WINDOW.performance.getEntriesByType('navigation')[0];

// Check to ensure the `responseStart` property is present and valid.
// In some cases no value is reported by the browser (for
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { runOnce } from './runOnce';
* if the browser's visibility state is (or becomes) hidden.
*/
export const whenIdle = (cb: () => void): number => {
const rIC = self.requestIdleCallback || self.setTimeout;
const rIC = WINDOW.requestIdleCallback || WINDOW.setTimeout;

let handle = -1;
// eslint-disable-next-line no-param-reassign
Expand Down

0 comments on commit 2803e51

Please sign in to comment.