From 6ee9b56d19ad79a60ca9e61d769a5d065c9cbc0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20H=C3=B6rberg?= Date: Wed, 17 Jul 2024 00:54:09 +0200 Subject: [PATCH] Web Worker compability `window` is not available in Web Worker, but `navigator` should be. `navigator` should also be a top-level object in window context. Fixes #117 --- src/amqp-websocket-client.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/amqp-websocket-client.ts b/src/amqp-websocket-client.ts index 64eb7c5..2bca313 100644 --- a/src/amqp-websocket-client.ts +++ b/src/amqp-websocket-client.ts @@ -144,8 +144,8 @@ export class AMQPWebSocketClient extends AMQPBaseClient { } static platform(): string { - if (typeof(window) !== 'undefined') - return window.navigator.userAgent + if (typeof(navigator) !== 'undefined') + return navigator.userAgent else return `${process.release.name} ${process.version} ${process.platform} ${process.arch}` }