@bloks/link-session-manager
Advanced tools
Comparing version 0.2.629 to 0.2.630
/** | ||
* proton-link-session-manager v0.2.629 | ||
* proton-link-session-manager v0.2.630 | ||
* https://github.com/greymass/proton-link-session-manager | ||
@@ -4,0 +4,0 @@ * |
/** | ||
* proton-link-session-manager v0.2.629 | ||
* proton-link-session-manager v0.2.630 | ||
* https://github.com/greymass/proton-link-session-manager | ||
@@ -108,2 +108,3 @@ * | ||
function RobustWebSocket(url, userOptions) { | ||
var _this = this; | ||
if (userOptions === void 0) { userOptions = {}; } | ||
@@ -116,2 +117,17 @@ this.attempts = 0; | ||
this.binaryType = 'blob'; | ||
this.listeners = { | ||
open: [ | ||
function (event) { | ||
if (_this.connectTimeout) { | ||
clearTimeout(_this.connectTimeout); | ||
_this.connectTimeout = undefined; | ||
} | ||
event.reconnects = ++_this.reconnects; | ||
event.attempts = _this.attempts; | ||
_this.attempts = 0; | ||
_this.reconnectWhenOnlineAgain = false; | ||
}, | ||
], | ||
close: [this.reconnect], | ||
}; | ||
this.opts = { | ||
@@ -330,35 +346,11 @@ // the time to wait before a successful connection | ||
}; | ||
Object.defineProperty(RobustWebSocket.prototype, "listeners", { | ||
get: function () { | ||
var _this = this; | ||
return { | ||
open: [ | ||
function (event) { | ||
if (_this.connectTimeout) { | ||
clearTimeout(_this.connectTimeout); | ||
_this.connectTimeout = undefined; | ||
} | ||
event.reconnects = ++_this.reconnects; | ||
event.attempts = _this.attempts; | ||
_this.attempts = 0; | ||
_this.reconnectWhenOnlineAgain = false; | ||
}, | ||
], | ||
close: [this.reconnect], | ||
}; | ||
}, | ||
enumerable: false, | ||
configurable: true | ||
}); | ||
// Taken from MDN https://developer.mozilla.org/en-US/docs/Web/API/EventTarget | ||
RobustWebSocket.prototype.addEventListener = function (type, callback) { | ||
if (!(type in this.listeners)) { | ||
if (!this.listeners[type]) { | ||
this.listeners[type] = []; | ||
} | ||
console.log(19); | ||
this.listeners[type].push(callback); | ||
console.log(20); | ||
}; | ||
RobustWebSocket.prototype.removeEventListener = function (type, callback) { | ||
if (!(type in this.listeners)) { | ||
if (!this.listeners[type]) { | ||
return; | ||
@@ -375,3 +367,3 @@ } | ||
RobustWebSocket.prototype.dispatchEvent = function (event) { | ||
if (!(event.type in this.listeners)) { | ||
if (!this.listeners[event.type]) { | ||
return; | ||
@@ -378,0 +370,0 @@ } |
/** | ||
* proton-link-session-manager v0.2.629 | ||
* proton-link-session-manager v0.2.630 | ||
* https://github.com/greymass/proton-link-session-manager | ||
@@ -91,2 +91,17 @@ * | ||
this.binaryType = 'blob'; | ||
this.listeners = { | ||
open: [ | ||
(event) => { | ||
if (this.connectTimeout) { | ||
clearTimeout(this.connectTimeout); | ||
this.connectTimeout = undefined; | ||
} | ||
event.reconnects = ++this.reconnects; | ||
event.attempts = this.attempts; | ||
this.attempts = 0; | ||
this.reconnectWhenOnlineAgain = false; | ||
}, | ||
], | ||
close: [this.reconnect], | ||
}; | ||
this.opts = { | ||
@@ -271,30 +286,11 @@ // the time to wait before a successful connection | ||
} | ||
get listeners() { | ||
return { | ||
open: [ | ||
(event) => { | ||
if (this.connectTimeout) { | ||
clearTimeout(this.connectTimeout); | ||
this.connectTimeout = undefined; | ||
} | ||
event.reconnects = ++this.reconnects; | ||
event.attempts = this.attempts; | ||
this.attempts = 0; | ||
this.reconnectWhenOnlineAgain = false; | ||
}, | ||
], | ||
close: [this.reconnect], | ||
}; | ||
} | ||
// Taken from MDN https://developer.mozilla.org/en-US/docs/Web/API/EventTarget | ||
addEventListener(type, callback) { | ||
if (!(type in this.listeners)) { | ||
if (!this.listeners[type]) { | ||
this.listeners[type] = []; | ||
} | ||
console.log(19); | ||
this.listeners[type].push(callback); | ||
console.log(20); | ||
} | ||
removeEventListener(type, callback) { | ||
if (!(type in this.listeners)) { | ||
if (!this.listeners[type]) { | ||
return; | ||
@@ -311,3 +307,3 @@ } | ||
dispatchEvent(event) { | ||
if (!(event.type in this.listeners)) { | ||
if (!this.listeners[event.type]) { | ||
return; | ||
@@ -314,0 +310,0 @@ } |
{ | ||
"name": "@bloks/link-session-manager", | ||
"description": "Session management for signature providers when receiving requests using the Anchor Link protocol", | ||
"version": "0.2.629", | ||
"version": "0.2.630", | ||
"homepage": "https://github.com/greymass/proton-link-session-manager", | ||
@@ -6,0 +6,0 @@ "license": "BSD-3-Clause", |
@@ -15,2 +15,18 @@ export default class RobustWebSocket { | ||
listeners = { | ||
open: [ | ||
(event) => { | ||
if (this.connectTimeout) { | ||
clearTimeout(this.connectTimeout) | ||
this.connectTimeout = undefined | ||
} | ||
event.reconnects = ++this.reconnects | ||
event.attempts = this.attempts | ||
this.attempts = 0 | ||
this.reconnectWhenOnlineAgain = false | ||
}, | ||
], | ||
close: [this.reconnect], | ||
} | ||
opts: { | ||
@@ -246,32 +262,13 @@ timeout: number | ||
get listeners() { | ||
return { | ||
open: [ | ||
(event) => { | ||
if (this.connectTimeout) { | ||
clearTimeout(this.connectTimeout) | ||
this.connectTimeout = undefined | ||
} | ||
event.reconnects = ++this.reconnects | ||
event.attempts = this.attempts | ||
this.attempts = 0 | ||
this.reconnectWhenOnlineAgain = false | ||
}, | ||
], | ||
close: [this.reconnect], | ||
} | ||
} | ||
// Taken from MDN https://developer.mozilla.org/en-US/docs/Web/API/EventTarget | ||
addEventListener(type, callback) { | ||
if (!(type in this.listeners)) { | ||
if (!this.listeners[type]) { | ||
this.listeners[type] = [] | ||
} | ||
console.log(19) | ||
this.listeners[type].push(callback) | ||
console.log(20) | ||
} | ||
removeEventListener(type, callback) { | ||
if (!(type in this.listeners)) { | ||
if (!this.listeners[type]) { | ||
return | ||
@@ -289,3 +286,3 @@ } | ||
dispatchEvent(event) { | ||
if (!(event.type in this.listeners)) { | ||
if (!this.listeners[event.type]) { | ||
return | ||
@@ -292,0 +289,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
105268
1808