Skip to content

Commit 667a183

Browse files
Feat: Improve python demo.
1 parent 03c806c commit 667a183

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

demo/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@
4040
<textarea id="ed"
4141
class="no-scrollbar w-full bg-transparent p-2 outline-none resize-none text-[#c2c2c2] placeholder-[#404040] overflow-y-auto"
4242
spellcheck="false"
43-
placeholder="Type your Python code here..."
44-
>print("Hello, world!")</textarea>
43+
placeholder="Type your Python code here...">
44+
</textarea>
4545
</div>
4646
</div>
4747

demo/main.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ const WASM_SOURCES = DEV
55
: ['./compiler_lib.wasm'];
66
const FETCH_OPTS = DEV ? { cache: 'no-store' } : undefined;
77

8+
const DEFAULT_CODE = `def add(a: int, b: int) -> int:\n return a + b\nresult: int = add(13, 20)\nprint(result)`;
9+
810
const CLS = { ok: 'ml-auto text-[#7daf7a]', err: 'ml-auto text-[#d67f6d]' };
911
const MAX_LINES = 99;
1012
const $ = (id) => document.getElementById(id);
@@ -67,5 +69,7 @@ ed.addEventListener('keydown', (e) => {
6769
});
6870
ed.oninput = ed.onscroll = sync;
6971

72+
ed.value = DEFAULT_CODE;
73+
7074
sync();
7175
loadWasm();

0 commit comments

Comments
 (0)