vim-web 0.3.42-dev.1 → 0.3.42-dev.3

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/vim-web.js CHANGED
@@ -59786,12 +59786,11 @@ class SocketClient {
59786
59786
  } else {
59787
59787
  this._clearSocket();
59788
59788
  this._connectPromise.reject("Connection to a different server");
59789
- this._connectPromise = new ControllablePromise();
59790
59789
  }
59791
- } else if (this._connectingUrl !== url) {
59792
- this._connectPromise = new ControllablePromise();
59793
- this._connectingUrl = url;
59794
59790
  }
59791
+ this._connectPromise = new ControllablePromise();
59792
+ this._connectingUrl = settings2.url;
59793
+ this._retries = settings2.retries;
59795
59794
  this.updateState({ status: "connecting" });
59796
59795
  try {
59797
59796
  this._socket = new WebSocket(url);
@@ -59914,19 +59913,22 @@ class SocketClient {
59914
59913
  * @param _event - The event object.
59915
59914
  */
59916
59915
  _onClose(_event) {
59916
+ this._logger.log("WebSocket closed.");
59917
59917
  clearTimeout(this._connectionTimeout);
59918
59918
  this._disconnect({ status: "error", error: "connection", serverUrl: this._connectingUrl });
59919
- this._logger.log("WebSocket closed.");
59920
- if (this._retries !== 0) {
59921
- this._logger.log("Attempting to reconnect in 5 seconds");
59922
- this._reconnectTimeout = setTimeout(() => {
59923
- this.updateState({ status: "connecting" });
59924
- this.connect({
59925
- url: this._connectingUrl,
59926
- retries: this._retries - 1
59927
- });
59928
- }, 5e3);
59919
+ if (this._retries === 0) {
59920
+ this._logger.log("No more retries left");
59921
+ this._connectPromise.resolve();
59922
+ return;
59929
59923
  }
59924
+ this._logger.log("Attempting to reconnect in 5 seconds");
59925
+ this._reconnectTimeout = setTimeout(() => {
59926
+ this.updateState({ status: "connecting" });
59927
+ this.connect({
59928
+ url: this._connectingUrl,
59929
+ retries: this._retries - 1
59930
+ });
59931
+ }, 5e3);
59930
59932
  }
59931
59933
  /**
59932
59934
  * Sends binary data over the WebSocket connection.