Skip to content

Commit

Permalink
fixup! Create notification doms every time.
Browse files Browse the repository at this point in the history
  • Loading branch information
tamuratak committed Nov 13, 2024
1 parent bb835db commit 37c2bf8
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions viewer/components/extensionconnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 37c2bf8

Please sign in to comment.