@bloks/link-session-manager
Advanced tools
Comparing version 0.2.616 to 0.2.617
/** | ||
* proton-link-session-manager v0.2.616 | ||
* proton-link-session-manager v0.2.617 | ||
* https://github.com/greymass/proton-link-session-manager | ||
@@ -117,3 +117,2 @@ * | ||
updateLastUsed(publicKey: PublicKey): void; | ||
heartbeat(): void; | ||
connect(): Promise<WebSocket>; | ||
@@ -120,0 +119,0 @@ disconnect(): Promise<void>; |
/** | ||
* proton-link-session-manager v0.2.616 | ||
* proton-link-session-manager v0.2.617 | ||
* https://github.com/greymass/proton-link-session-manager | ||
@@ -198,7 +198,10 @@ * | ||
this_2.realWs.addEventListener(stdEvent, function (event) { | ||
var args = []; | ||
for (var _i = 1; _i < arguments.length; _i++) { | ||
args[_i - 1] = arguments[_i]; | ||
} | ||
_this.dispatchEvent(event); | ||
var cb = _this['on' + stdEvent]; | ||
if (typeof cb === 'function') { | ||
// eslint-disable-next-line prefer-spread, prefer-rest-params | ||
return cb.apply(_this, arguments); | ||
return cb.apply(void 0, tslib.__spreadArray([event], tslib.__read(args))); | ||
} | ||
@@ -257,6 +260,6 @@ }); | ||
}; | ||
RobustWebSocket.prototype.send = function () { | ||
RobustWebSocket.prototype.send = function (data) { | ||
if (this.realWs) { | ||
// eslint-disable-next-line prefer-spread, prefer-rest-params | ||
return this.realWs.send.apply(this.realWs, arguments); | ||
return this.realWs.send(data); | ||
} | ||
@@ -493,19 +496,2 @@ }; | ||
}; | ||
ProtonLinkSessionManager.prototype.heartbeat = function () { | ||
var _this = this; | ||
clearTimeout(this.pingTimeout); | ||
this.pingTimeout = setTimeout(function () { return tslib.__awaiter(_this, void 0, void 0, function () { | ||
return tslib.__generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
if (!(this.socket && this.socket.readyState === 1)) return [3 /*break*/, 2]; | ||
return [4 /*yield*/, this.disconnect()]; | ||
case 1: | ||
_a.sent(); | ||
_a.label = 2; | ||
case 2: return [2 /*return*/]; | ||
} | ||
}); | ||
}); }, 10000 + 5000); | ||
}; | ||
ProtonLinkSessionManager.prototype.connect = function () { | ||
@@ -512,0 +498,0 @@ var _this = this; |
/** | ||
* proton-link-session-manager v0.2.616 | ||
* proton-link-session-manager v0.2.617 | ||
* https://github.com/greymass/proton-link-session-manager | ||
@@ -157,8 +157,7 @@ * | ||
for (const stdEvent of ['open', 'close', 'message', 'error', 'ping']) { | ||
this.realWs.addEventListener(stdEvent, (event) => { | ||
this.realWs.addEventListener(stdEvent, (event, ...args) => { | ||
this.dispatchEvent(event); | ||
const cb = this['on' + stdEvent]; | ||
if (typeof cb === 'function') { | ||
// eslint-disable-next-line prefer-spread, prefer-rest-params | ||
return cb.apply(this, arguments); | ||
return cb(event, ...args); | ||
} | ||
@@ -203,6 +202,6 @@ }); | ||
} | ||
send() { | ||
send(data) { | ||
if (this.realWs) { | ||
// eslint-disable-next-line prefer-spread, prefer-rest-params | ||
return this.realWs.send.apply(this.realWs, arguments); | ||
return this.realWs.send(data); | ||
} | ||
@@ -429,10 +428,2 @@ } | ||
} | ||
heartbeat() { | ||
clearTimeout(this.pingTimeout); | ||
this.pingTimeout = setTimeout(async () => { | ||
if (this.socket && this.socket.readyState === 1) { | ||
await this.disconnect(); | ||
} | ||
}, 10000 + 5000); | ||
} | ||
connect() { | ||
@@ -439,0 +430,0 @@ // eslint-disable-next-line @typescript-eslint/no-this-alias |
{ | ||
"name": "@bloks/link-session-manager", | ||
"description": "Session management for signature providers when receiving requests using the Anchor Link protocol", | ||
"version": "0.2.616", | ||
"version": "0.2.617", | ||
"homepage": "https://github.com/greymass/proton-link-session-manager", | ||
@@ -6,0 +6,0 @@ "license": "BSD-3-Clause", |
@@ -95,11 +95,2 @@ import WebSocket from 'isomorphic-ws' | ||
heartbeat() { | ||
clearTimeout(this.pingTimeout) | ||
this.pingTimeout = setTimeout(async () => { | ||
if (this.socket && this.socket.readyState === 1) { | ||
await this.disconnect() | ||
} | ||
}, 10000 + 5000) | ||
} | ||
connect(): Promise<WebSocket> { | ||
@@ -106,0 +97,0 @@ // eslint-disable-next-line @typescript-eslint/no-this-alias |
@@ -104,3 +104,3 @@ export default class RobustWebSocket { | ||
for (const stdEvent of ['open', 'close', 'message', 'error', 'ping']) { | ||
this.realWs.addEventListener(stdEvent, (event) => { | ||
this.realWs.addEventListener(stdEvent, (event, ...args) => { | ||
this.dispatchEvent(event) | ||
@@ -110,4 +110,3 @@ | ||
if (typeof cb === 'function') { | ||
// eslint-disable-next-line prefer-spread, prefer-rest-params | ||
return cb.apply(this, arguments) | ||
return cb(event, ...args) | ||
} | ||
@@ -158,6 +157,6 @@ }) | ||
send() { | ||
send(data) { | ||
if (this.realWs) { | ||
// eslint-disable-next-line prefer-spread, prefer-rest-params | ||
return this.realWs.send.apply(this.realWs, arguments as any) | ||
return this.realWs.send(data) | ||
} | ||
@@ -164,0 +163,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
102453
1762