-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathindex.html
More file actions
38 lines (31 loc) · 1.17 KB
/
index.html
File metadata and controls
38 lines (31 loc) · 1.17 KB
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
<html>
<body>
<script src="fetch_test.js"></script>
<script type='text/javascript'>
var LoadData = Module.cwrap('LoadData', null, ['number']);
var SaveData = Module.cwrap('SaveData', null, ['string', 'number']);
// WASM side calls this function after a submit
var onSave = Module.addFunction(
function onSave(response) {
document.getElementById('status').innerHTML = Module.UTF8ToString(response);
}, 'vi'
);
// WASM side calls this function after a retrieve
var onLoad = Module.addFunction(
function (data) {
document.getElementById('memo').value = Module.UTF8ToString(data);
}, 'vi'
);
// this function gets called when utils code is ready
function OnUtilsReady() {
LoadData(onLoad);
}
Module.OnUtilsReady = OnUtilsReady;
</script>
<label>Notepad:</label><br>
<textarea id="memo" rows="16" cols="80"></textarea><br>
<button onclick="LoadData(onLoad);" >Revert</button>
<button onclick="SaveData(document.getElementById('memo').value, onSave);" >Save</button>
<label id="status"></label>
</body>
</html>