diff options
Diffstat (limited to '')
| -rw-r--r-- | demo/src/compile.ts | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/demo/src/compile.ts b/demo/src/compile.ts new file mode 100644 index 0000000..4fca6c6 --- /dev/null +++ b/demo/src/compile.ts @@ -0,0 +1,20 @@ +const url = 'https://wokwi-hexi-73miufol2q-uc.a.run.app'; + +export interface IHexiResult { + stdout: string; + stderr: string; + hex: string; +} + +export async function buildHex(source: string) { + const resp = await fetch(url + '/build', { + method: 'POST', + mode: 'cors', + cache: 'no-cache', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify({ sketch: source }) + }); + return (await resp.json()) as IHexiResult; +} |
