From f1bf35526f0b53288a068f11a05dc3de9c8f9683 Mon Sep 17 00:00:00 2001 From: Paul Tagankin Date: Mon, 20 Apr 2026 15:21:28 +0300 Subject: [PATCH] testing: telemetry delivering --- src/WebTelemetryTransport.ts | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/WebTelemetryTransport.ts b/src/WebTelemetryTransport.ts index 1b8819a..b2d71c8 100644 --- a/src/WebTelemetryTransport.ts +++ b/src/WebTelemetryTransport.ts @@ -10,10 +10,12 @@ export class WebTelemetryTransportDefault implements WebTelemetryTransport { } send(body: string) { - if (navigator.sendBeacon) { - navigator.sendBeacon(this.url, body); + if (typeof navigator.sendBeacon === 'function') { + console.log('sendBeacon'); + // navigator.sendBeacon(this.url, body); } else { - fetch(this.url, { body, method: 'POST' }); + console.log('fetch'); + // fetch(this.url, { body, method: 'POST' }); } } } @@ -26,17 +28,17 @@ export class WebTelemetryTransportJson implements WebTelemetryTransport { } send(body: string) { - if (navigator.sendBeacon) { + if (typeof navigator.sendBeacon === 'function') { const blob = new Blob([body], { type: 'application/json' }); - navigator.sendBeacon(this.url, blob); + // navigator.sendBeacon(this.url, blob); } else { - fetch(this.url, { - body, - method: 'POST', - headers: { - 'Content-type': 'application/json', - }, - }); + // fetch(this.url, { + // body, + // method: 'POST', + // headers: { + // 'Content-type': 'application/json', + // }, + // }); } } }