@lcap/wave-sandbox-sdk 0.0.6 → 0.0.7

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/client.d.ts CHANGED
@@ -26,6 +26,10 @@ export declare class WaveSandboxClient {
26
26
  * 断开连接
27
27
  */
28
28
  disconnect(): void;
29
+ /**
30
+ * 销毁客户端实例,释放连接与监听器
31
+ */
32
+ destroy(): void;
29
33
  /**
30
34
  * 检查是否已连接
31
35
  */
package/dist/client.js CHANGED
@@ -62,6 +62,14 @@ export class WaveSandboxClient {
62
62
  disconnect() {
63
63
  this.socket.disconnect();
64
64
  }
65
+ /**
66
+ * 销毁客户端实例,释放连接与监听器
67
+ */
68
+ destroy() {
69
+ this.socket.disconnect();
70
+ this.socket.removeAllListeners();
71
+ this.socket.io.removeAllListeners();
72
+ }
65
73
  /**
66
74
  * 检查是否已连接
67
75
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lcap/wave-sandbox-sdk",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "description": "SDK for Wave Sandbox Client",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/client.ts CHANGED
@@ -80,6 +80,15 @@ export class WaveSandboxClient {
80
80
  this.socket.disconnect();
81
81
  }
82
82
 
83
+ /**
84
+ * 销毁客户端实例,释放连接与监听器
85
+ */
86
+ destroy(): void {
87
+ this.socket.disconnect();
88
+ this.socket.removeAllListeners();
89
+ this.socket.io.removeAllListeners();
90
+ }
91
+
83
92
  /**
84
93
  * 检查是否已连接
85
94
  */