Only emit disconnected event if previously connected.
This commit is contained in:
parent
ae4af99c59
commit
0b4f808b2d
@ -161,7 +161,10 @@ assign(Api.prototype, {
|
|||||||
|
|
||||||
this_._jsonRpc.failPendingRequests(new ConnectionLost());
|
this_._jsonRpc.failPendingRequests(new ConnectionLost());
|
||||||
|
|
||||||
this_.emit('disconnected');
|
// Only emit this event if connected before.
|
||||||
|
if (deferred.promise.isFulfilled()) {
|
||||||
|
this_.emit('disconnected');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
socket.addEventListener('error', function (error) {
|
socket.addEventListener('error', function (error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user