-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Milestone
Description
If I understand correctly you call rust function from JS like:
esses.invoke_rust_op_sync("print", "this will be printed")
is it possible to invoke it like:
print("this will be printed")
Writing rust functions for JS is still pretty hard (not hard as writing it directly for mozjs):
fn reg_op(rt: &EsRuntimeWrapper) {
rt.register_op(
"my_rusty_op",
Arc::new(|_rt, args: Vec<EsValueFacade>| {
let a = args.get(0).unwrap().get_i32();
let b = args.get(1).unwrap().get_i32();
Ok(EsValueFacade::new_i32(a * b))
}),
);
}My idea is that adding rusty code to JS should be as close as writing normal rust code and than just telling es_runtime to use that function (preferably even without special types, using Rusts types).
Metadata
Metadata
Assignees
Labels
No labels