diff options
-rw-r--r-- | actioncable/app/assets/javascripts/action_cable.js | 4 | ||||
-rw-r--r-- | actioncable/app/javascript/action_cable/connection_monitor.js | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/actioncable/app/assets/javascripts/action_cable.js b/actioncable/app/assets/javascripts/action_cable.js index 2b51eadb9e..280adbfa83 100644 --- a/actioncable/app/assets/javascripts/action_cable.js +++ b/actioncable/app/assets/javascripts/action_cable.js @@ -49,7 +49,7 @@ this.startedAt = now(); delete this.stoppedAt; this.startPolling(); - document.addEventListener("visibilitychange", this.visibilityDidChange); + addEventListener("visibilitychange", this.visibilityDidChange); logger.log("ConnectionMonitor started. pollInterval = " + this.getPollInterval() + " ms"); } }; @@ -57,7 +57,7 @@ if (this.isRunning()) { this.stoppedAt = now(); this.stopPolling(); - document.removeEventListener("visibilitychange", this.visibilityDidChange); + removeEventListener("visibilitychange", this.visibilityDidChange); logger.log("ConnectionMonitor stopped"); } }; diff --git a/actioncable/app/javascript/action_cable/connection_monitor.js b/actioncable/app/javascript/action_cable/connection_monitor.js index f0e75ae137..312a71d154 100644 --- a/actioncable/app/javascript/action_cable/connection_monitor.js +++ b/actioncable/app/javascript/action_cable/connection_monitor.js @@ -21,7 +21,7 @@ class ConnectionMonitor { this.startedAt = now() delete this.stoppedAt this.startPolling() - document.addEventListener("visibilitychange", this.visibilityDidChange) + addEventListener("visibilitychange", this.visibilityDidChange) logger.log(`ConnectionMonitor started. pollInterval = ${this.getPollInterval()} ms`) } } @@ -30,7 +30,7 @@ class ConnectionMonitor { if (this.isRunning()) { this.stoppedAt = now() this.stopPolling() - document.removeEventListener("visibilitychange", this.visibilityDidChange) + removeEventListener("visibilitychange", this.visibilityDidChange) logger.log("ConnectionMonitor stopped") } } |