| Crates.io | javy |
| lib.rs | javy |
| version | 5.0.0 |
| created_at | 2023-05-17 17:26:53.159663+00 |
| updated_at | 2025-08-29 17:32:03.631243+00 |
| description | Configurable JavaScript runtime for WebAssembly |
| homepage | https://github.com/bytecodealliance/javy/tree/main/crates/javy |
| repository | https://github.com/bytecodealliance/javy/tree/main/crates/javy |
| max_upload_size | |
| id | 867111 |
| size | 141,458 |
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::Result;
use javy::quickjs::{
function::{MutFn, Rest},
Ctx, Function, Value
};
use javy::{from_js_error, Runtime};
fn main() -> Result<()> {
let runtime = Runtime::default();
let context = runtime.context();
context.with(|cx| {
let globals = cx.globals();
globals.set(
"print_hello",
Function::new(
cx.clone(),
MutFn::new(|_: Ctx<'_>, _: Rest<Value<'_>>| {
println!("Hello, world!");
}),
)?,
)
})?;
context.with(|cx| {
cx.eval_with_options("print_hello();", Default::default())
.map_err(|e| from_js_error(cx.clone(), e))
.map(|_: ()| ())
})?;
Ok(())
}
To publish this crate to crates.io, run ./publish.sh. You will likely need to
run git submodule deinit test262 so the working tree is small enough for the
publishing to succeed.