Closed i18nsite closed 2 months ago
Hi @i18n-now
The best example right now would be to look at: https://github.com/awslabs/llrt/blob/main/llrt/src/main.rs
However I don't think we re-export everything you'd need from rquickjs binding lib.
To get return value in rust you have to access the js context and it can be done like this:
let vm = Vm::new().await?;
vm.ctx.with(|ctx| => {
ctx.globals().set("myFunction",|myValue:String|{
println!("Hello from JS: {}",myValue);
})
}).await;
@i18n-now we're working on decoupling LLRT from the AWS dependencies and publishing the crates. That will make it a bit simpler to integrate. I'll close this issue as it's being tracked here: https://github.com/awslabs/llrt/issues/351
for example:
How should I embed llrt and call the default function and get the return value in rust?
How should I inject native functions into llrt using rust?