Skip to content

Commit

Permalink
fix invalid detection of document ready #43
Browse files Browse the repository at this point in the history
Fix initalization of the library when load event already fired.
  • Loading branch information
jcubic committed Aug 21, 2022
1 parent 1d0b3cc commit c4db4b5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion sysend.js
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,11 @@
sysend.emit('__primary__');
}
// -------------------------------------------------------------------------
if (document.readyState === 'complete') {
function document_ready() {
return ['interactive', 'complete'].indexOf(document.readyState) !== -1;
}
// -------------------------------------------------------------------------
if (document_ready()) {
init();
} else {
window.addEventListener('load', function() {
Expand Down

0 comments on commit c4db4b5

Please sign in to comment.