Skip to content

Commit

Permalink
fix: fixed readyState
Browse files Browse the repository at this point in the history
  • Loading branch information
titanism committed May 31, 2023
1 parent 9104d06 commit 3037577
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 <body>
// <https://caniuse.com/domcontentloaded>
//
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')
});
});
}

0 comments on commit 3037577

Please sign in to comment.