use wasm_bindgen::prelude::*;
#[wasm_bindgen]
pub struct WasmRockets;
#[wasm_bindgen]
impl WasmRockets {
#[wasm_bindgen(constructor)]
pub fn new() -> Self {
Self
}
#[wasm_bindgen(js_name = runCommand)]
pub fn run_command(&self, line: &str) -> Result<String, JsValue> {
let args = crate::command::tokenize(line);
crate::command::run(&args).map_err(|e| JsValue::from_str(&e))
}
#[wasm_bindgen(js_name = version)]
pub fn version(&self) -> String {
env!("CARGO_PKG_VERSION").to_string()
}
}
impl Default for WasmRockets {
fn default() -> Self {
Self::new()
}
}