-
Notifications
You must be signed in to change notification settings - Fork 0
/
js-dcc.html
36 lines (32 loc) · 1.2 KB
/
js-dcc.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<!DOCTYPE html>
<html>
<head>
<title>BF JavaScript dynamic-code-creation implementation (single function)</title>
<script src="bfCode.js"></script>
<script>
onload = async () => {
const worker = new Worker('./js-dcc.js');
window.worker = worker; // avoid Safari's bug: https://bugs.webkit.org/show_bug.cgi?id=240062
const startTime = Date.now();
worker.postMessage(bfCode);
worker.onmessage = (e) => {
if (e.data) {
document.getElementsByTagName('pre')[0].textContent += String.fromCharCode(e.data);
} else {
document.getElementsByTagName('span')[0].textContent = `time: ${(Date.now() - startTime) / 1000} sec.`;
worker.terminate();
}
};
};
</script>
</head>
<body>
<h1>BF JavaScript dynamic-code-creation implementation (single function)</h1>
Source: <a href="https://github.com/tkihira/dynamic-wasm/blob/main/js-dcc.js" target="_blank">https://github.com/tkihira/dynamic-wasm/blob/main/js-dcc.js</a>
<hr>
<pre></pre>
<span></span>
<hr>
Go to <a href="./">top</a>.
</body>
</html>