summaryrefslogtreecommitdiff
path: root/ext/fg/js/frontend-api-sender.js
diff options
context:
space:
mode:
authorsiikamiika <siikamiika@users.noreply.github.com>2020-03-07 00:32:45 +0200
committersiikamiika <siikamiika@users.noreply.github.com>2020-03-07 00:32:45 +0200
commit8b76761744ca36d9b0c9523d3d7a80430d21abcb (patch)
tree95559783ab46f7fb100e3c064907af9d1c8de3dc /ext/fg/js/frontend-api-sender.js
parent421b60db0f6f132cbc5993488041846055a76d11 (diff)
reconnect FrontendApiSender after disconnecting
Diffstat (limited to 'ext/fg/js/frontend-api-sender.js')
-rw-r--r--ext/fg/js/frontend-api-sender.js3
1 files changed, 3 insertions, 0 deletions
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');