2024-06-16 16:29:25 +00:00
|
|
|
use crate::STORE;
|
|
|
|
use zoon::*;
|
2024-06-15 21:15:28 +00:00
|
|
|
|
2024-06-16 16:29:25 +00:00
|
|
|
#[wasm_bindgen(
|
|
|
|
inline_js = r#"export function strict_eval(code) { "use strict"; return eval?.(`${code}`) }"#
|
|
|
|
)]
|
2024-06-15 21:15:28 +00:00
|
|
|
extern "C" {
|
|
|
|
#[wasm_bindgen(catch)]
|
|
|
|
pub fn strict_eval(code: &str) -> Result<JsValue, JsValue>;
|
|
|
|
}
|
|
|
|
|
|
|
|
#[wasm_bindgen]
|
|
|
|
pub struct FW;
|
|
|
|
|
|
|
|
#[wasm_bindgen]
|
|
|
|
impl FW {
|
2024-06-16 16:29:25 +00:00
|
|
|
pub fn say_hello() -> String {
|
|
|
|
"Hello!".to_owned()
|
2024-06-15 21:15:28 +00:00
|
|
|
}
|
|
|
|
|
2024-06-16 16:29:25 +00:00
|
|
|
pub fn clear_variables() -> String {
|
|
|
|
let mut vars = STORE.selected_var_refs.lock_mut();
|
|
|
|
let var_count = vars.len();
|
|
|
|
vars.clear();
|
|
|
|
format!("{var_count} variables cleared")
|
2024-06-15 21:15:28 +00:00
|
|
|
}
|
|
|
|
}
|