Update dialog

This commit is contained in:
Robin Davies
2024-08-25 00:20:48 -04:00
parent faee21041a
commit b989ac5c92
25 changed files with 1857 additions and 221 deletions
+6 -2
View File
@@ -41,7 +41,7 @@ export interface PiPedalSocketListener {
onError: (message: string, exception?: Error) => void;
onConnectionLost: () => void;
onReconnect: () => void;
onReconnecting: (retry: number, maxRetries: number) => void;
onReconnecting: (retry: number, maxRetries: number) => boolean;
};
class PiPedalSocket {
@@ -183,6 +183,7 @@ class PiPedalSocket {
handleClose(_event: any): any {
if (this.retrying) {
this.close();
// treat this as a fatal error.
if (this.listener) {
this.listener.onError("Server connection lost.");
@@ -230,7 +231,9 @@ class PiPedalSocket {
this.close();
}
this.listener.onReconnecting(this.retryCount,MAX_RETRIES);
if (!this.listener.onReconnecting(this.retryCount,MAX_RETRIES)) {
return;
}
++this.retryCount;
this.connectInternal_()
@@ -262,6 +265,7 @@ class PiPedalSocket {
this.socket.onmessage = null;
this.socket.onopen = null;
this.socket.close();
this.socket = undefined;
}
} catch (ignored)
{