@hotwired/turbo-rails 8.0.14 → 8.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5490,8 +5490,8 @@ window.Turbo = Turbo$1;
5490
5490
  addEventListener("turbo:before-fetch-request", encodeMethodIntoRequestBody);
5491
5491
 
5492
5492
  var adapters = {
5493
- logger: self.console,
5494
- WebSocket: self.WebSocket
5493
+ logger: typeof console !== "undefined" ? console : undefined,
5494
+ WebSocket: typeof WebSocket !== "undefined" ? WebSocket : undefined
5495
5495
  };
5496
5496
 
5497
5497
  var logger = {
@@ -5533,12 +5533,11 @@ class ConnectionMonitor {
5533
5533
  isRunning() {
5534
5534
  return this.startedAt && !this.stoppedAt;
5535
5535
  }
5536
- recordPing() {
5536
+ recordMessage() {
5537
5537
  this.pingedAt = now();
5538
5538
  }
5539
5539
  recordConnect() {
5540
5540
  this.reconnectAttempts = 0;
5541
- this.recordPing();
5542
5541
  delete this.disconnectedAt;
5543
5542
  logger.log("ConnectionMonitor recorded connect");
5544
5543
  }
@@ -5737,6 +5736,7 @@ Connection.prototype.events = {
5737
5736
  return;
5738
5737
  }
5739
5738
  const {identifier: identifier, message: message, reason: reason, reconnect: reconnect, type: type} = JSON.parse(event.data);
5739
+ this.monitor.recordMessage();
5740
5740
  switch (type) {
5741
5741
  case message_types.welcome:
5742
5742
  if (this.triedToReconnect()) {
@@ -5752,7 +5752,7 @@ Connection.prototype.events = {
5752
5752
  });
5753
5753
 
5754
5754
  case message_types.ping:
5755
- return this.monitor.recordPing();
5755
+ return null;
5756
5756
 
5757
5757
  case message_types.confirmation:
5758
5758
  this.subscriptions.confirmSubscription(identifier);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hotwired/turbo-rails",
3
- "version": "8.0.14",
3
+ "version": "8.0.16",
4
4
  "description": "The speed of a single-page web application without having to write any JavaScript",
5
5
  "module": "app/javascript/turbo/index.js",
6
6
  "main": "app/assets/javascripts/turbo.js",