space-react-client 0.2.1 → 0.2.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/index.d.ts CHANGED
@@ -59,6 +59,12 @@ declare class SpaceClient$1 {
59
59
  * @throws Will throw an error if the callback is not a function.
60
60
  */
61
61
  on(event: SpaceEvents, callback: (data: any) => void): void;
62
+ /**
63
+ * Removes event listeners.
64
+ * @param event (optional) The event to remove listeners for. If omitted, removes all listeners.
65
+ * @param callback (optional) The specific callback to remove.
66
+ */
67
+ off(event?: SpaceEvents, callback?: (data: any) => void): void;
62
68
  /**
63
69
  * Sets the user ID for the client and loads the pricing token for that user.
64
70
  * @param userId The user ID to set for the client.
package/dist/index.js CHANGED
@@ -91,6 +91,7 @@ class SpaceClient {
91
91
  this.wsUrl = config.url.replace(/^http/, 'ws') + '/events/pricings';
92
92
  this.socketClient = io(this.wsUrl, {
93
93
  path: '/events',
94
+ transports: ['websocket'],
94
95
  });
95
96
  this.pricingSocketNamespace = this.socketClient.io.socket('/pricings');
96
97
  this.apiKey = config.apiKey;
@@ -156,6 +157,22 @@ class SpaceClient {
156
157
  }
157
158
  this.emitter.on(event, callback);
158
159
  }
160
+ /**
161
+ * Removes event listeners.
162
+ * @param event (optional) The event to remove listeners for. If omitted, removes all listeners.
163
+ * @param callback (optional) The specific callback to remove.
164
+ */
165
+ off(event, callback) {
166
+ if (event && callback) {
167
+ this.emitter.off(event, callback);
168
+ }
169
+ else if (event) {
170
+ this.emitter.off(event);
171
+ }
172
+ else {
173
+ this.emitter.off();
174
+ }
175
+ }
159
176
  /**
160
177
  * Sets the user ID for the client and loads the pricing token for that user.
161
178
  * @param userId The user ID to set for the client.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "space-react-client",
3
3
  "type": "module",
4
- "version": "0.2.1",
4
+ "version": "0.2.3",
5
5
  "description": "",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",