pusher / pusher-js

Pusher Javascript library
http://pusher.com
MIT License
2.12k stars 374 forks source link

[BUG][Worker] Reference error: window is not defined #651

Closed h4b00 closed 1 year ago

h4b00 commented 2 years ago

In the https://github.com/pusher/pusher-js/pull/584 we broke the conception of web workers by using window object inside the worker code.

The worker doesn't have access to the window object as it's working in the background.

What is the current behavior?

Reference error: window is not defined

What is the expected behavior?

It shouldn't raise any errors.

Extra info

Use 7.3.0 version as a workaround.

cc: @thegoncalomartins

thegoncalomartins commented 2 years ago

Right. This needs to be fixed, window object should not be used in the context of a worker. I can open a PR fixing this.

thegoncalomartins commented 2 years ago

I've opened the PR to fix this but it has failed tests on things that are (apparently) unrelated. If someone could take a look, it would be great.

fbenevides commented 1 year ago

We've just released 8.0.1 with the fix. Thanks to everyone involved.