scriptit is a simple way to run JavaScript code in Rust
scriptit will run your JS differently depending on your platform:
I wanted to be able to do scripting in my rust applications, I do not need a fully-fledged embedding of v8 like node or deno and the only use here is as a library, so you get to choose what to inject.
Additionally I want to write most of my rust apps with a possible wasm target: as we likely have a js engine when running rust code on wasm targets, I thought about using the js interpreter on the host. This makes scriptit an extremely lightweight way to run scripts in wasm as we use host capabilities to do so!
Due to those goals, scriptit will not give you the same amount of control that you would have embedding v8 yourself and will give you worst ergonomics than just using wasmbindgen. It is unfortunately ruled by common denominators on both apis (v8 & wasmbindgen).
```rust use scriptit::{ core::value::ScriptValue, ScriptingEnvironment };
let mut s_env = ScriptingEnvironment::new();
let src = "
const greeter = 'JS';
const greeted = 'Rust';
Hello ${greeted}! (from ${greeter}...)
";
let res = s_env.eval(src).unwrap();
asserteq!(res, ScriptValue::String("Hello Rust! (from JS...)".tostring())); ```
scriptit is extremely experimental, I wouldn't use it for anything now, at least not before the following is done:
See the issues for more details.