From 935e1f59091a5139397d7a32d52842e8865b0e97 Mon Sep 17 00:00:00 2001 From: Jesse Selover Date: Wed, 8 May 2024 04:06:28 -0700 Subject: [PATCH] Fix indentation and use setTimeout instead of setInterval. --- src/ui/unavailable-modal-ui-handler.ts | 34 +++++++++++++------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/ui/unavailable-modal-ui-handler.ts b/src/ui/unavailable-modal-ui-handler.ts index 137469a0d..b9d374b73 100644 --- a/src/ui/unavailable-modal-ui-handler.ts +++ b/src/ui/unavailable-modal-ui-handler.ts @@ -44,23 +44,23 @@ export default class UnavailableModalUiHandler extends ModalUiHandler { } tryReconnect(): void { - updateUserInfo().then(response => { - if (response[0] || [200, 400].includes(response[1])) { - clearInterval(this.reconnectTimer); - this.reconnectTimer = null; - this.reconnectInterval = 5000; - this.scene.playSound('pb_bounce_1'); - this.reconnectCallback(); - } - else { - clearInterval(this.reconnectTimer); - this.reconnectInterval *= 2; - if (this.reconnectInterval >= 60000) { - this.reconnectInterval = 60000; // 1 minute maximum delay. - } - this.reconnectTimer = setInterval(this.tryReconnect, this.reconnectInterval); - } - }); + updateUserInfo().then(response => { + if (response[0] || [200, 400].includes(response[1])) { + clearInterval(this.reconnectTimer); + this.reconnectTimer = null; + this.reconnectInterval = 5000; + this.scene.playSound('pb_bounce_1'); + this.reconnectCallback(); + } + else { + clearInterval(this.reconnectTimer); + this.reconnectInterval *= 2; + if (this.reconnectInterval > 60000) { + this.reconnectInterval = 60000; // 1 minute maximum delay. + } + this.reconnectTimer = setTimeout(this.tryReconnect, this.reconnectInterval); + } + }); } show(args: any[]): boolean {