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
…4157)

Co-authored-by: Marc Pichler <[email protected]>
  • Loading branch information
cristianmadularu and pichlermarc authored Sep 26, 2023
1 parent 2b9832e commit 2499708
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions experimental/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ All notable changes to experimental packages in this project will be documented

### :bug: (Bug Fix)

* fix(otlp-exporter-base): replaced usage of window with _globalThis [#4157](https://github.com/open-telemetry/opentelemetry-js/pull/4157) @cristianmadularu

### :books: (Refine Doc)

### :house: (Internal)
Expand Down
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 2499708

Please sign in to comment.