Clone in a terminal:
README.md
Repository root - Readme
# Callback Macro

This is a tag for annotating Rust functions that should be used as callbacks in
JavaScript using the kaja-web framework.

Example usage:
```rust
use kaja_html_macro;
use kaja_web::prelude::*;

#[derive(serde::Deserialize)]
struct SomeClickEvent {
    index: usize,
}

#[callback("someClickCallback")]
fn some_on_click_function(event: SomeClickEvent) {
    log!("event.index: {:?}", event.index);
}

pub fn example() -> String {
    // This example allows you to call the Rust function from JavaScript like this:
    let html = html! {{
        <button onclick="someClickCallback({
            index: 1
        })">Run WASM Callback</button>
    }};

    html
}

#[wasm_bindgen(start)]
pub fn init() {
    // make the callbacks available to JavaScript
    init_callbacks(); 
}
```

## Home Page
https://kajacode.com/kajaweb.html

## Author and Contact
- Written by Johan Mattsson
- johan.mattsson.m@gmail.com
- https://kajacode.com

File history (6 commits)

be02970 Johan Mattsson - johan.mattsson.m@gmail.com
Readme
Readme
d2a093f Johan Mattsson - johan.mattsson.m@gmail.com
Update readme
Update readme
ff703d1 Johan Mattsson - johan.mattsson.m@gmail.com
Update README.md
Update README.md
04dee4d Johan Mattsson - johan.mattsson.m@gmail.com
Pass HTML element to callback
Pass HTML element to callback
1ad421b Johan Mattsson - johan.mattsson.m@gmail.com
Update README.md
Update README.md
2bdcbb8 Johan Mattsson - johan.mattsson.m@gmail.com
Readme
Readme

Contact

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