1 | "use strict";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | Object.defineProperty(exports, "__esModule", { value: true });
|
18 | exports.BatchSpanProcessor = void 0;
|
19 | const BatchSpanProcessorBase_1 = require("../../../export/BatchSpanProcessorBase");
|
20 | class BatchSpanProcessor extends BatchSpanProcessorBase_1.BatchSpanProcessorBase {
|
21 | constructor(_exporter, config) {
|
22 | super(_exporter, config);
|
23 | this.onInit(config);
|
24 | }
|
25 | onInit(config) {
|
26 | if ((config === null || config === void 0 ? void 0 : config.disableAutoFlushOnDocumentHide) !== true && document != null) {
|
27 | this._visibilityChangeListener = () => {
|
28 | if (document.visibilityState === 'hidden') {
|
29 | void this.forceFlush();
|
30 | }
|
31 | };
|
32 | this._pageHideListener = () => {
|
33 | void this.forceFlush();
|
34 | };
|
35 | document.addEventListener('visibilitychange', this._visibilityChangeListener);
|
36 |
|
37 | document.addEventListener('pagehide', this._pageHideListener);
|
38 | }
|
39 | }
|
40 | onShutdown() {
|
41 | if (this._visibilityChangeListener) {
|
42 | document.removeEventListener('visibilitychange', this._visibilityChangeListener);
|
43 | }
|
44 | if (this._pageHideListener) {
|
45 | document.removeEventListener('pagehide', this._pageHideListener);
|
46 | }
|
47 | }
|
48 | }
|
49 | exports.BatchSpanProcessor = BatchSpanProcessor;
|
50 |
|
\ | No newline at end of file |