Skip to content

Commit 35f2d76

Browse files
authored
Merge pull request #126 from netlify/async-loading
Support async loading
2 parents a846327 + f9b868c commit 35f2d76

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/index.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ if (typeof exports !== undefined) {
66
if (typeof window !== undefined) {
77
window.netlifyIdentity = netlifyIdentity;
88
}
9-
10-
document.addEventListener("DOMContentLoaded", () => {
9+
if (document.readyState === "loading") {
10+
document.addEventListener("DOMContentLoaded", () => {
11+
netlifyIdentity.init();
12+
});
13+
} else {
1114
netlifyIdentity.init();
12-
});
15+
}

0 commit comments

Comments
 (0)