From 4d168401e926c50a8f78704e549cbe59eaf4ef12 Mon Sep 17 00:00:00 2001 From: Romain Lanz Date: Sun, 28 Jan 2024 22:54:40 +0100 Subject: [PATCH] perf: wait 100ms before setting up callback --- resources/app.ts | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/resources/app.ts b/resources/app.ts index 27ad73f..6512c99 100644 --- a/resources/app.ts +++ b/resources/app.ts @@ -46,10 +46,12 @@ function loadModelViewerScript() { modelViewerScriptLoaded = true } -window.requestIdleCallback(() => { - loadModelViewerScript() -}) - -window.addEventListener('resize', () => { - loadModelViewerScript() -}) +setTimeout(() => { + window.requestIdleCallback(() => { + loadModelViewerScript() + }) + + window.addEventListener('resize', () => { + loadModelViewerScript() + }) +}, 100)