From 8aa90dfe62580ccd8fddd952a1cd9d61d22ea5ed Mon Sep 17 00:00:00 2001 From: Dave Nichols Date: Wed, 18 Dec 2024 16:32:53 +0000 Subject: [PATCH] Updating Spline with background and no delay --- blocks/spline-viewer/spline-viewer.js | 6 ++---- fragments/spline.html | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/blocks/spline-viewer/spline-viewer.js b/blocks/spline-viewer/spline-viewer.js index 9ef61bc7..642d59da 100644 --- a/blocks/spline-viewer/spline-viewer.js +++ b/blocks/spline-viewer/spline-viewer.js @@ -11,10 +11,8 @@ export default async function decorate(block) { const observer = new IntersectionObserver((entries) => { if (entries.some((e) => e.isIntersecting)) { observer.disconnect(); - setTimeout(() => { - loadScript(fragmentHtml?.head?.firstElementChild?.src, { type: 'module' }); - block.append(fragmentHtml?.body?.firstElementChild); - }, 2000); + loadScript(fragmentHtml?.head?.firstElementChild?.src, { type: 'module' }); + block.append(fragmentHtml?.body?.firstElementChild); } }); observer.observe(block); diff --git a/fragments/spline.html b/fragments/spline.html index 4d28cb89..1579b2a1 100644 --- a/fragments/spline.html +++ b/fragments/spline.html @@ -1,2 +1,2 @@ - - \ No newline at end of file + +Spline preview \ No newline at end of file