-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
53 lines (44 loc) · 1.12 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
53
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<p>Select a cobre module to run (it can only have dependencies on cobre core modules)</p>
<input type="file" id="fileinput" value="" onchange="upload()">
<pre id="contentpre"></pre>
<script type="text/javascript" src="bundle.js"></script>
<script type="text/javascript">
var _log = console.log
console.log = function () {
_log.apply(console, arguments)
var str = arguments[0]
if (typeof str === "undefined" || str === null) str = ""
contentpre.textContent += str + "\n"
}
var jscode
var count = 0
function compile (buffer) {
Auro.state.reset()
var modname = 'main' + count++
Auro.modules[modname] = buffer
try {
jscode = Auro.compile(modname, 'browser')
var fn = new Function(jscode)
fn()
} catch (e) {
contentpre.textContent += String(e) + "\n"
throw e
}
}
var reader = new FileReader()
reader.onload = function () {
compile(new Uint8Array(reader.result))
}
function upload () {
reader.readAsArrayBuffer(fileinput.files[0])
}
</script>
<script type="application/auro" src="demo" auro-main="auro-main"></script>
</body>
</html>