Spaces:
Sleeping
Sleeping
Create web/app.js
Browse files- web/app.js +12 -0
web/app.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
async function runProgram() {
|
| 2 |
+
const program = document.getElementById("program").value;
|
| 3 |
+
|
| 4 |
+
const response = await fetch("/run", {
|
| 5 |
+
method: "POST",
|
| 6 |
+
headers: { "Content-Type": "application/json" },
|
| 7 |
+
body: JSON.stringify({ program_hex: program })
|
| 8 |
+
});
|
| 9 |
+
|
| 10 |
+
const data = await response.json();
|
| 11 |
+
document.getElementById("output").textContent = data.stdout || data.stderr;
|
| 12 |
+
}
|