Async JS loading/evaluation

This commit is contained in:
Ian Gulliver
2018-11-21 15:27:01 +00:00
parent 2d077296a6
commit 12594d49b3
2 changed files with 9 additions and 3 deletions

View File

@@ -11,7 +11,7 @@
<link rel="preload" href="proxima-nova-semibold.woff2" as="font" type="font/woff2" crossorigin> <link rel="preload" href="proxima-nova-semibold.woff2" as="font" type="font/woff2" crossorigin>
<link rel="icon" href="favicon.ico" type="image/x-icon"> <link rel="icon" href="favicon.ico" type="image/x-icon">
<link rel="stylesheet" href="passmate.css"> <link rel="stylesheet" href="passmate.css">
<script src="passmate.js"></script> <script src="passmate.js" async="true"></script>
</head> </head>
<body> <body>

View File

@@ -281,6 +281,12 @@ class PassMate {
} }
} }
document.addEventListener('DOMContentLoaded', () => { function onReady() {
new PassMate(document.getElementsByTagName('body')[0]); new PassMate(document.getElementsByTagName('body')[0]);
}); }
if (document.readyState === "loading") {
document.addEventListener('DOMContentLoaded', onReady);
} else {
onReady();
}