Skip to content

Commit

Permalink
🐛 Merge pull request #541 from titanism/master
Browse files Browse the repository at this point in the history
fix: fixed readyState
  • Loading branch information
AnandChowdhary authored May 31, 2023
2 parents 0161cba + 3037577 commit fe601cf
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 fe601cf

Please sign in to comment.