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', + // }, + // }); } } }