From 8d5d458c96293823117d8f1972ddf87e56f83550 Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Tue, 22 Feb 2022 17:56:15 -0500 Subject: [PATCH] Ensures preload will be removed --- src/webviews/apps/shared/appBase.ts | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/webviews/apps/shared/appBase.ts b/src/webviews/apps/shared/appBase.ts index 234a221..c5c8c2c 100644 --- a/src/webviews/apps/shared/appBase.ts +++ b/src/webviews/apps/shared/appBase.ts @@ -46,20 +46,22 @@ export abstract class App { requestAnimationFrame(() => { this.log(`${this.appName}.initializing`); - this.onInitialize?.(); - this.bind(); + try { + this.onInitialize?.(); + this.bind(); - if (this.onMessageReceived != null) { - window.addEventListener('message', this.onMessageReceived.bind(this)); - } - - this.sendCommand(WebviewReadyCommandType, undefined); + if (this.onMessageReceived != null) { + window.addEventListener('message', this.onMessageReceived.bind(this)); + } - this.onInitialized?.(); + this.sendCommand(WebviewReadyCommandType, undefined); - setTimeout(() => { - document.body.classList.remove('preload'); - }, 500); + this.onInitialized?.(); + } finally { + setTimeout(() => { + document.body.classList.remove('preload'); + }, 500); + } }); }