@liberfi.io/react-predict 0.1.68 → 0.1.70

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.
package/dist/index.js CHANGED
@@ -507,7 +507,7 @@ var PredictWsClient = class {
507
507
  this.reconnectMax = config.reconnectMaxInterval ?? DEFAULT_RECONNECT_MAX;
508
508
  this.pingMs = config.pingInterval ?? DEFAULT_PING_INTERVAL;
509
509
  this.pongTimeoutMs = config.pongTimeout ?? DEFAULT_PONG_TIMEOUT;
510
- if (config.autoConnect !== false) {
510
+ if (config.autoConnect !== false && typeof window !== "undefined") {
511
511
  this.connect();
512
512
  }
513
513
  }
@@ -515,6 +515,7 @@ var PredictWsClient = class {
515
515
  // Connection management
516
516
  // -------------------------------------------------------------------------
517
517
  connect() {
518
+ if (typeof window === "undefined") return;
518
519
  if (this.ws && (this.ws.readyState === WebSocket.OPEN || this.ws.readyState === WebSocket.CONNECTING)) {
519
520
  return;
520
521
  }