monorepo/kifu/ffi/kifu-wasm/src/lib.rs

31 lines
651 B
Rust
Raw Normal View History

use wasm_bindgen::prelude::*;
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(js_namespace = console)]
pub fn log(s: &str);
}
#[wasm_bindgen]
pub struct Request(kifu_core::Request);
/* Somehow uncommenting this code actually causes the module to not load. Maybe a name conflict?
* Don't know.
#[wasm_bindgen]
pub struct Response(kifu_core::Response);
*/
#[wasm_bindgen]
pub struct CoreApp(kifu_core::CoreApp);
#[wasm_bindgen]
pub fn coreapp_new() -> CoreApp {
log(&format!("coreapp_new"));
CoreApp(kifu_core::CoreApp::new())
}
#[wasm_bindgen]
pub async fn coreapp_dispatch(core: &CoreApp) {
log(&format!("coreapp_dispatch"));
}