summaryrefslogtreecommitdiff
path: root/ext/fg/js
diff options
context:
space:
mode:
authorsiikamiika <siikamiika@users.noreply.github.com>2020-03-08 00:50:24 +0200
committerGitHub <noreply@github.com>2020-03-08 00:50:24 +0200
commit4b0dfa92aaa9e088c2f59edb3adcb89f0b3c1053 (patch)
treef164bc24c03b30bb7ffe64251b9c4ae369cafcdb /ext/fg/js
parenteea9dc68b9f6c95ad2b98a5410a0340ba2151640 (diff)
parent8b76761744ca36d9b0c9523d3d7a80430d21abcb (diff)
Merge pull request #393 from siikamiika/reconnect-frontend-api-sender
reconnect FrontendApiSender after disconnecting
Diffstat (limited to 'ext/fg/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');