-
Notifications
You must be signed in to change notification settings - Fork 66
/
Copy pathindex.html
29 lines (28 loc) · 837 Bytes
/
index.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
<!doctype html>
<html>
<head>
<title>WAT Example</title>
<link rel="stylesheet" href="https://unpkg.com/[email protected]/css/xterm.css" />
</head>
<body>
<script src="https://unpkg.com/[email protected]/lib/xterm.js"></script>
<div id="terminal"></div>
<script>
var term = new Terminal();
term.open(document.getElementById('terminal'));
term.write('Hello from \x1B[1;3;31mxterm.js\x1B[0m\r\n');
const putchar = function(chr) {
if (chr == 0) {
console.log('warning: NULL')
}
var c = String.fromCharCode(chr);
if (c == '\n') {
c = '\r\n';
}
term.write(c);
}
var importObject = { host: { putchar: putchar } };
WebAssembly.instantiateStreaming(fetch('fizzbuzz.wasm'), importObject);
</script>
</body>
</html>