From 37c2bf83db34d5bcf28a9e2517eccbbcaa1fb36f Mon Sep 17 00:00:00 2001 From: Takashi Tamura <tamuratak@users.noreply.github.com> Date: Thu, 14 Nov 2024 08:05:57 +0900 Subject: [PATCH] fixup! Create notification doms every time. --- viewer/components/extensionconnection.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/viewer/components/extensionconnection.ts b/viewer/components/extensionconnection.ts index 59a0b26e..171f22e1 100644 --- a/viewer/components/extensionconnection.ts +++ b/viewer/components/extensionconnection.ts @@ -26,17 +26,16 @@ export class ExtensionConnection { document.body.appendChild(dom) } - private notifyReconnected() { + private async notifyReconnected() { const dom = document.createElement('div') dom.id = 'notify-reconnected' dom.textContent = 'Reconnected to LaTeX Toybox. Happy TeXing!' this.disconnectedNotificationDom?.remove() document.body.appendChild(dom) - setTimeout(async () => { - dom.classList.add('hide') - await sleep(1000) - dom.remove() - }, 3000) + await sleep(3000) + dom.classList.add('hide') + await sleep(1000) + dom.remove() } private setupConnectionPort() { @@ -75,7 +74,7 @@ export class ExtensionConnection { try { this.connectionPort = new ConnectionPort() await this.connectionPort.readyPromise - this.notifyReconnected() + void this.notifyReconnected() this.setupConnectionPort() console.log('Reconnected: WebScocket to LaTeX Toybox.') return