Javascript karat
//Neon is a good way to communicate between your js and Rust code
//https://crates.io/crates/neon
//eg
fn make_an_array(mut cx: FunctionContext) -> JsResult<JsArray> {
// Create some values:
let n = cx.number(9000);
let s = cx.string("hello");
let b = cx.boolean(true);
// Create a new array:
let array: Handle<JsArray> = cx.empty_array();
// Push the values into the array:
array.set(&mut cx, 0, n)?;
array.set(&mut cx, 1, s)?;
array.set(&mut cx, 2, b)?;
// Return the array:
Ok(array)
}
MXO