<!DOCTYPE html>
<html>
<head>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type"/>
</head>
<body>
<pre id="output" style="visibility:hidden">Loading scripts...</pre>
<pre id="console_output" style="visibility:hidden"></pre>
<script>
const hashParams = new URLSearchParams(location.hash.replace(/^#/, ""));
const styleMode = hashParams.get("wbg_style") === "display-none"
? "display:none"
: "visibility:hidden";
for (const id of ["output", "console_output"]) {
document.getElementById(id).setAttribute("style", styleMode);
}
const orig = id => (...args) => {
const logs = document.getElementById(id);
for (const msg of args) {
logs.appendChild(document.createTextNode(String(msg) + "\n"));
}
};
const wrap = method => {
const on_method = `on_console_${method}`;
console[method] = function (...args) {
if (nocapture) {
orig("output").apply(this, args);
} else {
orig("console_output").apply(this, args);
}
if (window[on_method]) {
window[on_method](args);
}
};
};
wrap("debug");
wrap("log");
wrap("info");
wrap("warn");
wrap("error");
window.__wbg_test_invoke = f => f();
</script>
</body>
</html>