Clone in a terminal:
Commit c043f7c
Johan Mattsson - 2026-06-01T19:09:44+00:00
c043f7c248223028b4909cd21216c4f5106cbc3cjohan.mattsson.m@gmail.com

Remove old macro

Changed files (2)

Diff

diff --git a/examples/clickcounter/src/lib.rs b/examples/clickcounter/src/lib.rsindex 0365e2f..c840763 100644--- a/examples/clickcounter/src/lib.rs+++ b/examples/clickcounter/src/lib.rs@@ -57,6 +57,5 @@ pub fn init() {      let mut app_data = APP_DATA.read().unwrap();     update_counter_display(&app_data);-     init_callbacks(); }diff --git a/src/lib.rs b/src/lib.rsindex 1aecfd2..cc62093 100644--- a/src/lib.rs+++ b/src/lib.rs@@ -159,53 +159,3 @@ pub fn try_inner_html(selector: &str, html: &str) { pub fn try_inner_text(selector: &str, text: &str) {     let _ = inner_text(selector, text); }--#[macro_export]-macro_rules! callback {-    ($js_name:ident, $rust_fn:path) => {{-        use wasm_bindgen::closure::Closure;-        use wasm_bindgen::JsCast;-        use wasm_bindgen::JsValue;--        let window = web_sys::window().unwrap();--        let cb = Closure::<dyn FnMut(JsValue)>::new(|val: JsValue| {-            let event: _ =-                serde_wasm_bindgen::from_value(val).expect("Failed to deserialize event");--            $rust_fn(event);-        });--        ::js_sys::Reflect::set(-            &window,-            &stringify!($js_name).into(),-            cb.as_ref().unchecked_ref(),-        )-        .unwrap();--        cb.forget();-    }};-}--#[cfg(all(test, target_arch = "wasm32"))]-mod tests {-    use crate::App;-    use crate::CallbackRegistration;-    use gloo_console::log;-    use js_sys;-    #[derive(Debug, serde::Deserialize)]-    struct SomeClickEvent {-        índex: usize,-    }--    #[kaja_callback_macro::callback("someClickCallback")]-    fn some_on_click_function(event: SomeClickEvent) {-        log!("event.índex: {:?}", event.índex);-    }--    #[test]-    fn test_compile() {-        let app = App::new();-        app.set_callbacks(); // 👈 registers ALL #[callback] functions automatically-    }-}

Contact

Email: johan.mattsson.m@gmail.com
Mastodon: typo.social/@birdfont
GitHub: johanmattssonm
LinkedIn: johan-mattsson-2ab324112