Skip to content

Commit c4db4b5

Browse files
committed
fix invalid detection of document ready #43
Fix initalization of the library when load event already fired.
1 parent 1d0b3cc commit c4db4b5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

sysend.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,11 @@
452452
sysend.emit('__primary__');
453453
}
454454
// -------------------------------------------------------------------------
455-
if (document.readyState === 'complete') {
455+
function document_ready() {
456+
return ['interactive', 'complete'].indexOf(document.readyState) !== -1;
457+
}
458+
// -------------------------------------------------------------------------
459+
if (document_ready()) {
456460
init();
457461
} else {
458462
window.addEventListener('load', function() {

0 commit comments

Comments
 (0)