From 3037577b24175c145a4f6e20ddcc918317297636 Mon Sep 17 00:00:00 2001 From: titanism <101466223+titanism@users.noreply.github.com> Date: Wed, 31 May 2023 04:33:06 -0500 Subject: [PATCH] fix: fixed readyState --- src/client.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/client.js b/src/client.js index 3c59e3d..f70eae2 100644 --- a/src/client.js +++ b/src/client.js @@ -5,8 +5,14 @@ import * as sapper from '@sapper/app'; // if we do not use this then we need to move sapper at end of // // -document.addEventListener('DOMContentLoaded', function() { +if (document.readyState !== 'loading') { sapper.start({ target: document.querySelector('#sapper') }); -}); +} else { + document.addEventListener('DOMContentLoaded', function() { + sapper.start({ + target: document.querySelector('#sapper') + }); + }); +}