-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
40 lines (38 loc) · 900 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
32
33
34
35
36
37
38
39
40
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<style>
textarea {
width: 49%;
height: 400px;
float: left;
}
</style>
</head>
<body>
<textarea id="code"></textarea>
<textarea id="result"></textarea><br/>
<button id="eval">eval</button>
<script src="../dist/Mason.min.js"></script>
<script>
document.getElementById("eval").onclick = function() {
var code = document.getElementById("code").value;
var result;
var env = new window.Mason.Environment();
env.def("AUTHOR", "Gizeta");
env.def("TEAM", "Five African");
env.def("PRINT", function(msg) {
console.log(msg);
return msg;
});
try {
result = window.Mason.Execute(code, env);
} catch (e) {
result = e.message;
}
document.getElementById("result").value = result;
};
</script>
</body>
</html>