hume 0.10.4-beta.3 → 0.10.4-beta.4

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.
@@ -13,6 +13,7 @@ export declare class CloseEvent extends Event {
13
13
  code: number;
14
14
  reason: string;
15
15
  wasClean: boolean;
16
+ willReconnect: boolean;
16
17
  constructor(code: number | undefined, reason: string | undefined, target: any);
17
18
  }
18
19
  export interface WebSocketEventMap {
@@ -21,6 +21,7 @@ class CloseEvent extends Event {
21
21
  constructor(code = 1000, reason = "", target) {
22
22
  super("close", target);
23
23
  this.wasClean = true;
24
+ this.willReconnect = false;
24
25
  this.code = code;
25
26
  this.reason = reason;
26
27
  }
@@ -166,6 +166,7 @@ class ReconnectingWebSocket {
166
166
  this._shouldReconnect = false;
167
167
  this._debug("Reconnection stopped: Received close code 1000 (intentional server close).");
168
168
  }
169
+ adaptedEvent.willReconnect = this._shouldReconnect;
169
170
  // Dispatch event to listeners
170
171
  if (this.onclose)
171
172
  this.onclose(adaptedEvent);
@@ -414,6 +415,7 @@ class ReconnectingWebSocket {
414
415
  this._listeners.error.forEach((listener) => this._callEventListener(errorEvent, listener));
415
416
  // Dispatch close event
416
417
  const closeEvent = new Events.CloseEvent(1000, closeReason, this);
418
+ closeEvent.willReconnect = false;
417
419
  if (this.onclose)
418
420
  this.onclose(closeEvent);
419
421
  this._listeners.close.forEach((listener) => this._callEventListener(closeEvent, listener));
@@ -13,6 +13,7 @@ export declare class CloseEvent extends Event {
13
13
  code: number;
14
14
  reason: string;
15
15
  wasClean: boolean;
16
+ willReconnect: boolean;
16
17
  constructor(code: number | undefined, reason: string | undefined, target: any);
17
18
  }
18
19
  export interface WebSocketEventMap {
@@ -21,6 +21,7 @@ class CloseEvent extends Event {
21
21
  constructor(code = 1000, reason = "", target) {
22
22
  super("close", target);
23
23
  this.wasClean = true;
24
+ this.willReconnect = false;
24
25
  this.code = code;
25
26
  this.reason = reason;
26
27
  }
@@ -166,6 +166,7 @@ class ReconnectingWebSocket {
166
166
  this._shouldReconnect = false;
167
167
  this._debug("Reconnection stopped: Received close code 1000 (intentional server close).");
168
168
  }
169
+ adaptedEvent.willReconnect = this._shouldReconnect;
169
170
  // Dispatch event to listeners
170
171
  if (this.onclose)
171
172
  this.onclose(adaptedEvent);
@@ -414,6 +415,7 @@ class ReconnectingWebSocket {
414
415
  this._listeners.error.forEach((listener) => this._callEventListener(errorEvent, listener));
415
416
  // Dispatch close event
416
417
  const closeEvent = new Events.CloseEvent(1000, closeReason, this);
418
+ closeEvent.willReconnect = false;
417
419
  if (this.onclose)
418
420
  this.onclose(closeEvent);
419
421
  this._listeners.close.forEach((listener) => this._callEventListener(closeEvent, listener));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hume",
3
- "version": "0.10.4-beta.3",
3
+ "version": "0.10.4-beta.4",
4
4
  "private": false,
5
5
  "repository": "https://github.com/HumeAI/hume-typescript-sdk",
6
6
  "main": "./index.js",