use wasm_bindgen::prelude::wasm_bindgen; #[wasm_bindgen] extern { fn alert(s: &str); // set the namespace so we can use ‘console.debug’ #[wasm_bindgen(js_namespace = console)] fn debug(s: &str); } #[wasm_bindgen] pub fn add(left: u32, right: u32) -> u32 { debug(&format!("adding the numbers {} and {}", left, right)); left + right } #[wasm_bindgen] pub fn test_alert(s: &str) { alert(s) }