-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
52 lines (44 loc) · 2.02 KB
/
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=PT+Serif&family=Roboto+Mono&display=swap" rel="stylesheet">
<link rel="stylesheet" href="./wwwroot/dist/libmodule.css">
<title></title>
</head>
<body>
<h1 class="heading">CORE</h1>
<ul id="wrap" class="content"></ul>
<script type="module">
import create_core_module from"./wwwroot/dist/module_core_wasm_web_async.js";
let instance = create_core_module({
locateFile: function(path) {
const baseURL = window.location.origin + window.location.pathname.substring(0, window.location.pathname.lastIndexOf( "/" ));
return baseURL + '/wwwroot/dist/' + path;
}
});
instance.then((module) => {
let hierarchy = module._createHierarchy();
let root = module._getRootNode(hierarchy);
let node_A = module._createNode();
let node_B = module._createNode();
module._addChildNode(root, node_A);
module._addChildNode(root, node_B);
const nodeLen = module._getNumOfChildNodes(root);
const nodeArr = Array.from(new Uint32Array(module.HEAPU32.buffer, module._getChildNodes(root), nodeLen));
for (let i = 0; i < nodeLen; i++) {
const charArr = new Int8Array(module.HEAP8.buffer, module._getNodeIndex(nodeArr[i]), 7);
const str = String.fromCharCode.apply(null, charArr);
let ul = document.getElementById("wrap");
let li = document.createElement("li");
ul.appendChild(li);
li.innerHTML = li.innerHTML + str;
}
});
</script>
</body>
</html>