Skip to content

Commit

Permalink
perf: wait 100ms before setting up callback
Browse files Browse the repository at this point in the history
  • Loading branch information
RomainLanz committed Jan 28, 2024
1 parent 878b724 commit 4d16840
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions resources/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,12 @@ function loadModelViewerScript() {
modelViewerScriptLoaded = true
}

window.requestIdleCallback(() => {
loadModelViewerScript()
})

window.addEventListener('resize', () => {
loadModelViewerScript()
})
setTimeout(() => {
window.requestIdleCallback(() => {
loadModelViewerScript()
})

window.addEventListener('resize', () => {
loadModelViewerScript()
})
}, 100)

0 comments on commit 4d16840

Please sign in to comment.