resilient-websocket
Advanced tools
Comparing version 1.0.8 to 1.0.9
@@ -40,2 +40,3 @@ export interface OnCallback { | ||
on: (event: WebSocketEvent, callback: OnCallback) => void; | ||
off: (event: WebSocketEvent, callback: OnCallback) => void; | ||
private respondToCallbacks; | ||
@@ -42,0 +43,0 @@ private onOpen; |
@@ -58,5 +58,5 @@ "use strict"; | ||
_this.socket.removeEventListener('open', _this.onOpen); | ||
_this.socket.removeEventListener('close', _this.onClose); | ||
_this.socket.close(); | ||
// Allow this to fire first | ||
_this.socket.removeEventListener('close', _this.onClose); | ||
_this.respondToCallbacks(WebSocketEvent.CLOSE, event); | ||
}; | ||
@@ -71,2 +71,8 @@ this.on = function (event, callback) { | ||
}; | ||
this.off = function (event, callback) { | ||
var callbackList = _this.callbacks.get(event); | ||
if (callbackList) { | ||
callbackList.delete(callback); | ||
} | ||
}; | ||
this.respondToCallbacks = function (event, data) { | ||
@@ -73,0 +79,0 @@ var callbacks = _this.callbacks.get(event); |
{ | ||
"name": "resilient-websocket", | ||
"version": "1.0.8", | ||
"version": "1.0.9", | ||
"description": "A client WebSocket wrapper with support for reconnection and ping/pong", | ||
@@ -5,0 +5,0 @@ "main": "dist/ResilientWebSocket.js", |
Sorry, the diff of this file is not supported yet
29971
218