fix: run script after document is ready (#25)

* Wait until document ready before main

* More robust ready state handling

Co-authored-by: alistair3149 <alistair3149@users.noreply.github.com>
This commit is contained in:
auburnsummer 2022-05-31 17:21:17 +10:00 committed by GitHub
parent 13c55e9403
commit e54a313de4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -374,4 +374,10 @@ function main() {
}
}
main();
if ( document.readyState === 'interactive' || document.readyState === 'complete' ) {
main();
} else {
document.addEventListener( 'DOMContentLoaded', function () {
main();
} );
};