mirror of
https://github.com/lexmount/moli.git
synced 2026-09-26 16:01:30 +00:00
80 lines
3.1 KiB
HTML
80 lines
3.1 KiB
HTML
<!doctype html>
|
|
<html>
|
|
<head></head>
|
|
<body>
|
|
<script>
|
|
window.lifecycleBridgeError = null;
|
|
|
|
try {
|
|
window.lifecycleDispatchHelpersMissing =
|
|
typeof globalThis.__moliDispatchDocumentEvent === "undefined" &&
|
|
typeof globalThis.__moliDispatchScriptLoad === "undefined";
|
|
|
|
let scriptNode = null;
|
|
let scriptLoadTargetMatched = false;
|
|
let scriptLoadCurrentTargetMatched = false;
|
|
let documentElementLoadTargetMatched = false;
|
|
let documentElementLoadCurrentTargetMatched = false;
|
|
|
|
let domContentLoadedCount = 0;
|
|
window.lifecycleDomContentLoadedCount = 0;
|
|
document.addEventListener("DOMContentLoaded", (event) => {
|
|
if (event.target === document && event.currentTarget === document) {
|
|
domContentLoadedCount += 1;
|
|
window.lifecycleDomContentLoadedCount = domContentLoadedCount;
|
|
}
|
|
});
|
|
document.__moliListeners = new Map();
|
|
|
|
let documentElementLoadCount = 0;
|
|
window.lifecycleDocumentElementLoadCount = 0;
|
|
document.documentElement.addEventListener("load", (event) => {
|
|
if (event.target === scriptNode) {
|
|
documentElementLoadTargetMatched = true;
|
|
window.lifecycleDocumentElementLoadTargetMatched = true;
|
|
documentElementLoadCount += 1;
|
|
window.lifecycleDocumentElementLoadCount = documentElementLoadCount;
|
|
}
|
|
if (event.currentTarget === document.documentElement) {
|
|
documentElementLoadCurrentTargetMatched = true;
|
|
window.lifecycleDocumentElementLoadCurrentTargetMatched = true;
|
|
}
|
|
});
|
|
document.documentElement.__moliListeners = new Map();
|
|
|
|
let scriptLoadCount = 0;
|
|
window.lifecycleScriptLoadCount = 0;
|
|
window.lifecycleScriptLoadTargetMatched = false;
|
|
window.lifecycleScriptLoadCurrentTargetMatched = false;
|
|
window.lifecycleDocumentElementLoadTargetMatched = false;
|
|
window.lifecycleDocumentElementLoadCurrentTargetMatched = false;
|
|
scriptNode = document.createElement("script");
|
|
scriptNode.id = "late-script";
|
|
scriptNode.onload = (event) => {
|
|
if (event.target === scriptNode) {
|
|
scriptLoadTargetMatched = true;
|
|
window.lifecycleScriptLoadTargetMatched = true;
|
|
}
|
|
if (event.currentTarget === scriptNode) {
|
|
scriptLoadCurrentTargetMatched = true;
|
|
window.lifecycleScriptLoadCurrentTargetMatched = true;
|
|
}
|
|
scriptLoadCount += 1;
|
|
window.lifecycleScriptLoadCount = scriptLoadCount;
|
|
};
|
|
scriptNode.src = "/assets/app.js";
|
|
document.head.appendChild(scriptNode);
|
|
|
|
window.lifecycleInlineReplayCount = 0;
|
|
const replayScript = document.createElement("script");
|
|
replayScript.text = "window.lifecycleInlineReplayCount += 1;";
|
|
document.body.appendChild(replayScript);
|
|
replayScript.__moliExecuted = false;
|
|
document.body.appendChild(replayScript);
|
|
} catch (error) {
|
|
window.lifecycleBridgeError = String(error);
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|