Skip to content

Commit

Permalink
Web Worker compability
Browse files Browse the repository at this point in the history
`window` is not available in Web Worker, but `navigator` should be.
`navigator` should also be a top-level object in window context.

Fixes #117
  • Loading branch information
carlhoerberg committed Jul 16, 2024
1 parent 4e0fdfc commit 6ee9b56
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/amqp-websocket-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`
}
Expand Down

0 comments on commit 6ee9b56

Please sign in to comment.