ToyJS is a minimal JavaScript runtime built with Rust and V8. It serves as an educational project to understand how JavaScript runtimes (like Node.js or Deno) work under the hood, featuring a custom event loop, native bindings, and ES module support.
- V8 Engine: Powered by the V8 JavaScript engine.
- ES Modules: Support for
importandexportsyntax. - Native Bindings:
print(msg): Print to stdout.add(a, b): Simple synchronous addition.
- Async Support:
setTimeout/setInterval: Timer operations.fetch: Basic HTTP requests (returns a Promise).
- Event Loop: Custom implementation using
tokioto handle asynchronous tasks.
$ cargo run exec -- js/index.js