-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
31 lines (28 loc) · 810 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
30
31
<!doctype html>
<html lang="en-US">
<head>
<meta charset="utf-8" />
<title>hello-wasm example</title>
</head>
<body>
<script type="module">
import init, {layout_asset_graph} from "./pkg/dagre_wasm.js";
const JsonPromise = new Promise((res) => {
console.log('fetching');
fetch("small_graph.json").then((response) => {
res(response.json())
})
})
init().then(() => {
JsonPromise.then((json) => {
const start = performance.now();
console.log(json);
const result = layout_asset_graph(JSON.stringify(json));
const end = performance.now();
console.log('elapsed', end - start);
document.body.innerHTML = "<pre>" + JSON.stringify(JSON.parse(result), null, 2) + "</pre>"
})
});
</script>
</body>
</html>