Skip to content

Commit

Permalink
bugfix: fix domReady, wait for the entire page to load
Browse files Browse the repository at this point in the history
  • Loading branch information
notthatjen committed Jun 18, 2024
1 parent e4d8595 commit 1eaba92
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,9 @@ export class Mini {

async _domReady() {
return new Promise((resolve) => {
if (document.readyState == 'loading') {
if (document.readyState == 'loading' || document.readyState == 'interactive') {
document.addEventListener('DOMContentLoaded', resolve)
} else {
document.removeEventListener('DOMContentLoaded', resolve)
resolve()
}
})
Expand Down

0 comments on commit 1eaba92

Please sign in to comment.