reconnect FrontendApiSender after disconnecting
This commit is contained in:
parent
421b60db0f
commit
8b76761744
@ -31,6 +31,8 @@ class FrontendApiSender {
|
|||||||
|
|
||||||
invoke(action, params, target) {
|
invoke(action, params, target) {
|
||||||
if (this.disconnected) {
|
if (this.disconnected) {
|
||||||
|
// attempt to reconnect the next time
|
||||||
|
this.disconnected = false;
|
||||||
return Promise.reject(new Error('Disconnected'));
|
return Promise.reject(new Error('Disconnected'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,6 +72,7 @@ class FrontendApiSender {
|
|||||||
|
|
||||||
onDisconnect() {
|
onDisconnect() {
|
||||||
this.disconnected = true;
|
this.disconnected = true;
|
||||||
|
this.port = null;
|
||||||
|
|
||||||
for (const id of this.callbacks.keys()) {
|
for (const id of this.callbacks.keys()) {
|
||||||
this.onError(id, 'Disconnected');
|
this.onError(id, 'Disconnected');
|
||||||
|
Loading…
Reference in New Issue
Block a user