diff options
author | Richard Macklin <richard.github@nrm.com> | 2019-01-15 22:14:33 -0800 |
---|---|---|
committer | Richard Macklin <richard.github@nrm.com> | 2019-01-15 22:14:33 -0800 |
commit | 39493185d315162933cd60cdecc8643c98ed845d (patch) | |
tree | a85d2892d6eb18c00c6405651efb947c8326b1fc /actiontext/lib/tasks | |
parent | ac8ffbe76a90d89a5655bea6af5abcac6c7320e0 (diff) | |
download | rails-39493185d315162933cd60cdecc8643c98ed845d.tar.gz rails-39493185d315162933cd60cdecc8643c98ed845d.tar.bz2 rails-39493185d315162933cd60cdecc8643c98ed845d.zip |
Remove explicit `document` receiver from add/removeEventListener calls
This allows ActionCable to be used in a web worker, where the `document`
global is undefined. Previously, attempting to use ActionCable inside a
web worker would result in this exception after you try to open a
connection:
```
ReferenceError: document is not defined
```
The visibilitychange event won't ever get triggered in a worker, so
adding the listener is effectively a no-op there. But the listener is
mainly a convenience, rather than a critical piece of the javascript
interface, so using ActionCable in a worker will still work. (And you
could listen for visibilitychange yourself in a window script, then tell
the worker to reconnect if you still want that behavior.)
Diffstat (limited to 'actiontext/lib/tasks')
0 files changed, 0 insertions, 0 deletions