From 8b76761744ca36d9b0c9523d3d7a80430d21abcb Mon Sep 17 00:00:00 2001 From: siikamiika Date: Sat, 7 Mar 2020 00:32:45 +0200 Subject: reconnect FrontendApiSender after disconnecting --- ext/fg/js/frontend-api-sender.js | 3 +++ 1 file changed, 3 insertions(+) (limited to 'ext') diff --git a/ext/fg/js/frontend-api-sender.js b/ext/fg/js/frontend-api-sender.js index 8dc6aaf3..4431df61 100644 --- a/ext/fg/js/frontend-api-sender.js +++ b/ext/fg/js/frontend-api-sender.js @@ -31,6 +31,8 @@ class FrontendApiSender { invoke(action, params, target) { if (this.disconnected) { + // attempt to reconnect the next time + this.disconnected = false; return Promise.reject(new Error('Disconnected')); } @@ -70,6 +72,7 @@ class FrontendApiSender { onDisconnect() { this.disconnected = true; + this.port = null; for (const id of this.callbacks.keys()) { this.onError(id, 'Disconnected'); -- cgit v1.2.3