From 73900d2374cecefabefee95ed0580517ecb7d7c8 Mon Sep 17 00:00:00 2001 From: Cristian M Date: Fri, 22 Sep 2023 10:58:05 -0400 Subject: [PATCH] fix(otlp-exporter-base): replaced usage of window with _globalThis Signed-off-by: Cristian M --- .../src/platform/browser/OTLPExporterBrowserBase.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/experimental/packages/otlp-exporter-base/src/platform/browser/OTLPExporterBrowserBase.ts b/experimental/packages/otlp-exporter-base/src/platform/browser/OTLPExporterBrowserBase.ts index 2888e317df..dbe02b222d 100644 --- a/experimental/packages/otlp-exporter-base/src/platform/browser/OTLPExporterBrowserBase.ts +++ b/experimental/packages/otlp-exporter-base/src/platform/browser/OTLPExporterBrowserBase.ts @@ -20,7 +20,7 @@ import * as otlpTypes from '../../types'; import { parseHeaders } from '../../util'; import { sendWithBeacon, sendWithXhr } from './util'; import { diag } from '@opentelemetry/api'; -import { getEnv, baggageUtils } from '@opentelemetry/core'; +import { getEnv, baggageUtils, _globalThis } from '@opentelemetry/core'; /** * Collector Metric Exporter abstract base class @@ -53,11 +53,11 @@ export abstract class OTLPExporterBrowserBase< } onInit(): void { - window.addEventListener('unload', this.shutdown); + _globalThis.addEventListener('unload', this.shutdown); } onShutdown(): void { - window.removeEventListener('unload', this.shutdown); + _globalThis.removeEventListener('unload', this.shutdown); } send(