5 stable releases

3.0.0 Jun 28, 2024
2.2.0 Jan 31, 2024
2.1.0 Sep 11, 2023
2.0.0 Aug 17, 2023
1.0.0 May 17, 2023

#1238 in WebAssembly

Download history 18/week @ 2024-03-28 9/week @ 2024-04-04 1/week @ 2024-04-11 4/week @ 2024-04-18 1/week @ 2024-04-25 4/week @ 2024-05-16 6/week @ 2024-05-23 26/week @ 2024-05-30 15/week @ 2024-06-06 14/week @ 2024-06-13 3/week @ 2024-06-20 139/week @ 2024-06-27 15/week @ 2024-07-04

158 downloads per month

Apache-2.0 WITH LLVM-exception

115KB
2.5K SLoC

Javy

A configurable JavaScript runtime for WebAssembly

Documentation Status crates.io status

Uses QuickJS through the rquickjs crate to evalulate JavaScript source code or QuickJS bytecode.

Refer to the crate level documentation to learn more.

Example usage:

use anyhow::anyhow;
use javy::{Runtime, from_js_error};
let runtime = Runtime::default();
let context = runtime.context();

context.with(|cx| {
    let globals = this.globals();
    globals.set(
        "print_hello",
        Function::new(
            this.clone(),
            MutFn::new(move |_, _| {
                println!("Hello, world!");
            }),
        )?,
    )?;
 });

context.with(|cx| {
    cx.eval_with_options(Default::default(), "print_hello();")
         .map_err(|e| from_js_error(cx.clone(), e))
         .map(|_| ())
});

Publishing to crates.io

To publish this crate to crates.io, run ./publish.sh.

Dependencies

~8–12MB
~274K SLoC