Skip to content

Commit

Permalink
fix(otlp-exporter-base): replaced usage of window with _globalThis
Browse files Browse the repository at this point in the history
Signed-off-by: Cristian M <[email protected]>
  • Loading branch information
cristianmadularu committed Sep 22, 2023
1 parent f2fc0d8 commit 73900d2
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 73900d2

Please sign in to comment.