Skip to content

Commit 410dfcc

Browse files
simonwclaude
andauthored
Build QuickJS code executor with live results (#166)
* Add quickjs.html - JavaScript code executor using QuickJS WebAssembly A UI that lets users enter JavaScript code in a textarea and execute it using quickjs-emscripten. Features: - Sandboxed execution via QuickJS running in WebAssembly - Console.log/warn/error/info support - URL hash state persistence (code saved as #url-encoded-javascript) - Auto-execute when loading page with hash - Keyboard shortcut (Ctrl/Cmd + Enter) to run code - Tab key support for indentation - Copy output to clipboard - Execution time display * Fix QuickJS loading and add Playwright tests Changes to quickjs.html: - Switch from esm.sh to cdn.jsdelivr.net (fixes MIME type errors) - Use IIFE global build instead of ES modules (better compatibility) - Fix version from 0.31.1 (doesn't exist) to 0.31.0 Add test infrastructure: - tests/conftest.py: Improved server fixture with proper startup waiting - tests/test_quickjs.py: Comprehensive Playwright tests for QuickJS executor - Tests skip gracefully when CDN is unreachable (isolated environments) - Covers page load, initialization, code execution, URL hash state, etc. * Add interactive examples with pill-style buttons - Added 10 clickable example snippets: Hello World, Factorial, Fibonacci, Array Methods, Objects & JSON, Prime Numbers, String Fun, FizzBuzz, Sorting, and Date & Time - Examples load into textarea and auto-execute when clicked - Pill-style buttons with hover effects for clean UI - Removed placeholder text in favor of example buttons --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 7c52a86 commit 410dfcc

File tree

4 files changed

+1090
-0
lines changed

4 files changed

+1090
-0
lines changed

quickjs.docs.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Execute JavaScript code in a sandboxed QuickJS environment running via WebAssembly. Code is automatically saved in the URL hash for easy sharing.

0 commit comments

Comments
 (0)