Skip to content

Commit

Permalink
Merge pull request #687 from pusher/fix-worker-global-this
Browse files Browse the repository at this point in the history
Fix 'window is not defined' error in worker context
  • Loading branch information
fbenevides authored Jan 18, 2023
2 parents 1a5ab73 + fe13fc5 commit 4aa4e3b
Show file tree
Hide file tree
Showing 18 changed files with 37 additions and 32 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 8.0.1

- [FIXED] Fix 'window is not defined' error in the worker context
- [FIXED] Specify the right status when an error is thrown for the pusher worker instance

## 8.0.0

- [CHANGED] Specifying a cluster when instantiating the Pusher object is now mandatory. An exception is thrown if the cluster setting is missing.
Expand Down
4 changes: 2 additions & 2 deletions dist/node/pusher.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/react-native/pusher.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/web/pusher-with-encryption.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/web/pusher-with-encryption.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/web/pusher.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/web/pusher.min.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions dist/worker/pusher-with-encryption.worker.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/worker/pusher-with-encryption.worker.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/worker/pusher-with-encryption.worker.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/worker/pusher-with-encryption.worker.min.js.map

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions dist/worker/pusher.worker.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/worker/pusher.worker.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/worker/pusher.worker.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/worker/pusher.worker.min.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pusher-js",
"version": "8.0.0",
"version": "8.0.1",
"description": "Pusher Channels JavaScript library for browsers, React Native, NodeJS and web workers",
"main": "dist/node/pusher.js",
"browser": "dist/web/pusher.js",
Expand Down
2 changes: 1 addition & 1 deletion src/runtimes/worker/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const Worker: Runtime = {
* Return values in the range of [0, 1[
*/
const random = function() {
const crypto = window.crypto || window['msCrypto'];
const crypto = globalThis.crypto || globalThis['msCrypto'];
const random = crypto.getRandomValues(new Uint32Array(1))[0];

return random / 2 ** 32;
Expand Down

0 comments on commit 4aa4e3b

Please sign in to comment.