-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.html
58 lines (51 loc) · 2.27 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
54
55
56
57
58
<!DOCTYPE html>
<html>
<head>
<title>TeaVM example</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<!--<script type="text/javascript" charset="utf-8" src="./build/generated/teavm/js/aya.js"></script>-->
<script type="text/javascript" charset="utf-8" src="./target/javascript/aya.js"></script>
<script type="text/javascript" charset="utf-8" src="./target/package-stdlib-js/aya-stdlib.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/6.65.7/codemirror.min.js" integrity="sha512-8RnEqURPUc5aqFEN04aQEiPlSAdE0jlFS/9iGgUyNtwFnSKCXhmB6ZTNl7LnDtDWKabJIASzXrzD0K+LYexU9g==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/6.65.7/codemirror.min.css" integrity="sha512-uf06llspW44/LZpHzHT6qBOIVODjWtv4MxCricRxkzvopAlSWnTf6hpZTFxuuZcuNE9CBQhqE0Seu1CoRk84nQ==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<script type="text/javascript">
var aya = {};
var editor = null;
function run() {
var input = "\"base/__aya__.aya\" :F ";
var out = aya.runIsolated(input + editor.getValue());
document.getElementById('out').innerHTML = out;
}
function setup() {
main();
// Exported functions
aya.runIsolated = main.runIsolated;
aya.addFile = main.addFile;
aya.listFiles = main.listFiles;
editor = CodeMirror(document.getElementById("code"), {
mode: "text/html",
theme: "neonsyntax",
lineWrapping: true,
lineNumbers: true,
styleActiveLine: true,
matchBrackets: true,
extraKeys: {
"Ctrl-Enter": (cm) => {
run();
}
},
});
for (const path of Object.keys(AYA_STDLIB)) {
aya.addFile(path, AYA_STDLIB[path]);
}
console.log(aya.listFiles());
run();
}
</script>
</head>
<body onload="setup()">
<i>Press Shift+Enter to run</i>
<div id="code" style="border: solid 1px;"></div>
<pre id="out"></pre>
</body>
</html>