aboutsummaryrefslogtreecommitdiffstats
path: root/actioncable/app/assets/javascripts/action_cable.js
diff options
context:
space:
mode:
authorRichard Macklin <richard.github@nrm.com>2018-10-18 22:00:06 -0700
committerRichard Macklin <richard.github@nrm.com>2019-01-14 17:44:35 -0800
commitac8ffbe76a90d89a5655bea6af5abcac6c7320e0 (patch)
tree0b9a0d21d7e04c56d15d899f479740a3d6f444c5 /actioncable/app/assets/javascripts/action_cable.js
parentfcd38cf19fa6249d5b62bbe887fde6120408e9c3 (diff)
downloadrails-ac8ffbe76a90d89a5655bea6af5abcac6c7320e0.tar.gz
rails-ac8ffbe76a90d89a5655bea6af5abcac6c7320e0.tar.bz2
rails-ac8ffbe76a90d89a5655bea6af5abcac6c7320e0.zip
Replace `window` references in ActionCable with `self`
Before this change, attempting to use ActionCable inside a web worker would result in an exception being thrown: ``` ReferenceError: window is not defined ``` By replacing the `window` reference with `self`, which is available in both a window context and a worker context, we can avoid this error. Ref: https://developer.mozilla.org/en-US/docs/Web/API/Window/self
Diffstat (limited to 'actioncable/app/assets/javascripts/action_cable.js')
-rw-r--r--actioncable/app/assets/javascripts/action_cable.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/actioncable/app/assets/javascripts/action_cable.js b/actioncable/app/assets/javascripts/action_cable.js
index a68c76f299..2b51eadb9e 100644
--- a/actioncable/app/assets/javascripts/action_cable.js
+++ b/actioncable/app/assets/javascripts/action_cable.js
@@ -3,8 +3,8 @@
})(this, function(exports) {
"use strict";
var adapters = {
- logger: window.console,
- WebSocket: window.WebSocket
+ logger: self.console,
+ WebSocket: self.WebSocket
};
var logger = {
log: function log() {