@bloks/link-session-manager
Advanced tools
Comparing version 0.2.632 to 0.2.633
/** | ||
* proton-link-session-manager v0.2.632 | ||
* proton-link-session-manager v0.2.633 | ||
* https://github.com/greymass/proton-link-session-manager | ||
@@ -4,0 +4,0 @@ * |
/** | ||
* proton-link-session-manager v0.2.632 | ||
* proton-link-session-manager v0.2.633 | ||
* https://github.com/greymass/proton-link-session-manager | ||
@@ -161,5 +161,3 @@ * | ||
} | ||
console.log(1); | ||
if (this.opts.automaticOpen) { | ||
console.log(2); | ||
this.newWebSocket(this.url); | ||
@@ -171,12 +169,7 @@ } | ||
var _this = this; | ||
console.log(2.5); | ||
// New websocket | ||
var newUrl = typeof url === 'function' ? url(this) : url; | ||
console.log(newUrl); | ||
this.pendingReconnect = null; | ||
console.log(2.6); | ||
this.realWs = new WebSocket(newUrl); | ||
console.log(2.7); | ||
this.realWs.binaryType = this.binaryType; | ||
console.log(3); | ||
this.attempts++; | ||
@@ -188,7 +181,5 @@ this.dispatchEvent({ | ||
}); | ||
console.log(4); | ||
this.connectTimeout = setTimeout(function () { | ||
_this.connectTimeout = null; | ||
_this.detachConnectivityEvents(); | ||
console.log(5); | ||
_this.dispatchEvent({ | ||
@@ -199,12 +190,8 @@ type: 'timeout', | ||
}); | ||
console.log(6); | ||
}, this.opts.timeout); | ||
var _loop_1 = function (stdEvent) { | ||
this_1.realWs.addEventListener(stdEvent, function (event) { | ||
console.log(7); | ||
_this.dispatchEvent(event); | ||
console.log(8); | ||
var cb = _this['on' + stdEvent]; | ||
if (typeof cb === 'function') { | ||
console.log(9); | ||
return cb(event); | ||
@@ -229,3 +216,2 @@ } | ||
if (this.opts.netInfo) { | ||
console.log(10); | ||
this.initializeConnectivity(); | ||
@@ -259,3 +245,2 @@ } | ||
_a.netInfoState = _b.sent(); | ||
console.log(17); | ||
_b.label = 2; | ||
@@ -265,3 +250,2 @@ case 2: | ||
this.attachConnectivityEvents(); | ||
console.log(18); | ||
} | ||
@@ -276,9 +260,6 @@ return [2 /*return*/]; | ||
if (!this.unsubscribeNetInfo && this.opts.netInfo && this.netInfoState) { | ||
console.log(11); | ||
this.unsubscribeNetInfo = this.opts.netInfo.addEventListener(function (state) { | ||
console.log(12); | ||
if (!state) { | ||
return; | ||
} | ||
console.log(13); | ||
// Offline -> Online | ||
@@ -290,3 +271,2 @@ var isOnline = state.isConnected && !_this.netInfoState.isConnected; | ||
} | ||
console.log(14); | ||
// Online -> Offline | ||
@@ -300,6 +280,4 @@ var isOffline = !state.isConnected && _this.netInfoState.isConnected; | ||
} | ||
console.log(15); | ||
// Update to latest | ||
_this.netInfoState = state; | ||
console.log(16); | ||
}); | ||
@@ -430,5 +408,3 @@ } | ||
ProtonLinkSessionManagerStorage.prototype.add = function (session) { | ||
console.log(22); | ||
this.sessions.push(session); | ||
console.log(23); | ||
}; | ||
@@ -553,3 +529,2 @@ ProtonLinkSessionManagerStorage.prototype.get = function (chainId, account, permission) { | ||
onSocketEvent('onmessage', event); | ||
console.log('onmessage data', event.data); | ||
_this.handleRequest(event.data); | ||
@@ -576,5 +551,3 @@ }); | ||
switch (_a.label) { | ||
case 0: | ||
console.log('disconnected'); | ||
return [4 /*yield*/, this.socket.close(1000)]; | ||
case 0: return [4 /*yield*/, this.socket.close(1000)]; | ||
case 1: | ||
@@ -581,0 +554,0 @@ _a.sent(); |
/** | ||
* proton-link-session-manager v0.2.632 | ||
* proton-link-session-manager v0.2.633 | ||
* https://github.com/greymass/proton-link-session-manager | ||
@@ -136,5 +136,3 @@ * | ||
} | ||
console.log(1); | ||
if (this.opts.automaticOpen) { | ||
console.log(2); | ||
this.newWebSocket(this.url); | ||
@@ -144,12 +142,7 @@ } | ||
newWebSocket(url) { | ||
console.log(2.5); | ||
// New websocket | ||
const newUrl = typeof url === 'function' ? url(this) : url; | ||
console.log(newUrl); | ||
this.pendingReconnect = null; | ||
console.log(2.6); | ||
this.realWs = new WebSocket(newUrl); | ||
console.log(2.7); | ||
this.realWs.binaryType = this.binaryType; | ||
console.log(3); | ||
this.attempts++; | ||
@@ -161,7 +154,5 @@ this.dispatchEvent({ | ||
}); | ||
console.log(4); | ||
this.connectTimeout = setTimeout(() => { | ||
this.connectTimeout = null; | ||
this.detachConnectivityEvents(); | ||
console.log(5); | ||
this.dispatchEvent({ | ||
@@ -172,12 +163,8 @@ type: 'timeout', | ||
}); | ||
console.log(6); | ||
}, this.opts.timeout); | ||
for (const stdEvent of ['open', 'close', 'message', 'error', 'ping']) { | ||
this.realWs.addEventListener(stdEvent, (event) => { | ||
console.log(7); | ||
this.dispatchEvent(event); | ||
console.log(8); | ||
const cb = this['on' + stdEvent]; | ||
if (typeof cb === 'function') { | ||
console.log(9); | ||
return cb(event); | ||
@@ -188,3 +175,2 @@ } | ||
if (this.opts.netInfo) { | ||
console.log(10); | ||
this.initializeConnectivity(); | ||
@@ -210,7 +196,5 @@ } | ||
this.netInfoState = await this.opts.netInfo.fetch(); | ||
console.log(17); | ||
} | ||
if (this.netInfoState) { | ||
this.attachConnectivityEvents(); | ||
console.log(18); | ||
} | ||
@@ -220,9 +204,6 @@ } | ||
if (!this.unsubscribeNetInfo && this.opts.netInfo && this.netInfoState) { | ||
console.log(11); | ||
this.unsubscribeNetInfo = this.opts.netInfo.addEventListener((state) => { | ||
console.log(12); | ||
if (!state) { | ||
return; | ||
} | ||
console.log(13); | ||
// Offline -> Online | ||
@@ -234,3 +215,2 @@ const isOnline = state.isConnected && !this.netInfoState.isConnected; | ||
} | ||
console.log(14); | ||
// Online -> Offline | ||
@@ -244,6 +224,4 @@ const isOffline = !state.isConnected && this.netInfoState.isConnected; | ||
} | ||
console.log(15); | ||
// Update to latest | ||
this.netInfoState = state; | ||
console.log(16); | ||
}); | ||
@@ -363,5 +341,3 @@ } | ||
add(session) { | ||
console.log(22); | ||
this.sessions.push(session); | ||
console.log(23); | ||
} | ||
@@ -480,3 +456,2 @@ get(chainId, account, permission) { | ||
onSocketEvent('onmessage', event); | ||
console.log('onmessage data', event.data); | ||
this.handleRequest(event.data); | ||
@@ -500,3 +475,2 @@ }); | ||
async disconnect() { | ||
console.log('disconnected'); | ||
await this.socket.close(1000); | ||
@@ -503,0 +477,0 @@ } |
{ | ||
"name": "@bloks/link-session-manager", | ||
"description": "Session management for signature providers when receiving requests using the Anchor Link protocol", | ||
"version": "0.2.632", | ||
"version": "0.2.633", | ||
"homepage": "https://github.com/greymass/proton-link-session-manager", | ||
@@ -6,0 +6,0 @@ "license": "BSD-3-Clause", |
@@ -116,3 +116,2 @@ import WebSocket from 'isomorphic-ws' | ||
onSocketEvent('onmessage', event) | ||
console.log('onmessage data', event.data) | ||
this.handleRequest(event.data) | ||
@@ -145,3 +144,2 @@ }) | ||
async disconnect() { | ||
console.log('disconnected') | ||
await this.socket.close(1000) | ||
@@ -148,0 +146,0 @@ } |
@@ -26,5 +26,3 @@ import {Checksum256, Name, PrivateKeyType, PublicKeyType} from '@greymass/eosio' | ||
public add(session: ProtonLinkSessionManagerSession) { | ||
console.log(22) | ||
this.sessions.push(session) | ||
console.log(23) | ||
} | ||
@@ -31,0 +29,0 @@ |
@@ -82,6 +82,4 @@ export default class RobustWebSocket { | ||
} | ||
console.log(1) | ||
if (this.opts.automaticOpen) { | ||
console.log(2) | ||
this.newWebSocket(this.url) | ||
@@ -92,12 +90,7 @@ } | ||
newWebSocket(url) { | ||
console.log(2.5) | ||
// New websocket | ||
const newUrl = typeof url === 'function' ? url(this) : url | ||
console.log(newUrl) | ||
this.pendingReconnect = null | ||
console.log(2.6) | ||
this.realWs = new WebSocket(newUrl) | ||
console.log(2.7) | ||
this.realWs.binaryType = this.binaryType | ||
console.log(3) | ||
@@ -110,3 +103,2 @@ this.attempts++ | ||
}) | ||
console.log(4) | ||
@@ -116,3 +108,2 @@ this.connectTimeout = setTimeout(() => { | ||
this.detachConnectivityEvents() | ||
console.log(5) | ||
@@ -124,3 +115,2 @@ this.dispatchEvent({ | ||
}) | ||
console.log(6) | ||
}, this.opts.timeout) | ||
@@ -130,10 +120,6 @@ | ||
this.realWs.addEventListener(stdEvent, (event) => { | ||
console.log(7) | ||
this.dispatchEvent(event) | ||
console.log(8) | ||
const cb = this['on' + stdEvent] | ||
if (typeof cb === 'function') { | ||
console.log(9) | ||
return cb(event) | ||
@@ -145,3 +131,2 @@ } | ||
if (this.opts.netInfo) { | ||
console.log(10) | ||
this.initializeConnectivity() | ||
@@ -171,3 +156,2 @@ } | ||
this.netInfoState = await this.opts.netInfo.fetch() | ||
console.log(17) | ||
} | ||
@@ -177,3 +161,2 @@ | ||
this.attachConnectivityEvents() | ||
console.log(18) | ||
} | ||
@@ -184,6 +167,3 @@ } | ||
if (!this.unsubscribeNetInfo && this.opts.netInfo && this.netInfoState) { | ||
console.log(11) | ||
this.unsubscribeNetInfo = this.opts.netInfo.addEventListener((state) => { | ||
console.log(12) | ||
if (!state) { | ||
@@ -193,3 +173,2 @@ return | ||
console.log(13) | ||
// Offline -> Online | ||
@@ -202,3 +181,2 @@ const isOnline = state.isConnected && !this.netInfoState.isConnected | ||
console.log(14) | ||
// Online -> Offline | ||
@@ -212,7 +190,5 @@ const isOffline = !state.isConnected && this.netInfoState.isConnected | ||
} | ||
console.log(15) | ||
// Update to latest | ||
this.netInfoState = state | ||
console.log(16) | ||
}) | ||
@@ -219,0 +195,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
100657
1736