Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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:

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);
}

// 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>
}};

Home Page

https://kajacode.com/kajaweb.html

Author and Contact

About

Create Rust functions in WASM and make the functions available from JS

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages