2023-04-21 02:23:13 +00:00
|
|
|
use wasm_bindgen::prelude::*;
|
|
|
|
|
|
|
|
#[wasm_bindgen]
|
|
|
|
extern "C" {
|
|
|
|
#[wasm_bindgen(js_namespace = console)]
|
|
|
|
pub fn log(s: &str);
|
|
|
|
}
|
|
|
|
|
2023-04-21 13:25:21 +00:00
|
|
|
/*
|
2023-04-21 02:23:13 +00:00
|
|
|
#[wasm_bindgen]
|
2023-04-21 13:25:21 +00:00
|
|
|
pub struct CoreRequest(kifu_core::Request);
|
2023-04-21 02:23:13 +00:00
|
|
|
|
|
|
|
#[wasm_bindgen]
|
2023-04-21 13:25:21 +00:00
|
|
|
impl CoreRequest {
|
|
|
|
#[wasm_bindgen(constructor)]
|
|
|
|
pub fn new(request: kifu_core::Request) -> Self {
|
|
|
|
Self(request)
|
|
|
|
}
|
|
|
|
}
|
2023-04-21 02:23:13 +00:00
|
|
|
*/
|
|
|
|
|
2023-04-21 13:25:21 +00:00
|
|
|
/* Somehow uncommenting this code actually causes the module to not load. Maybe a name conflict?
|
|
|
|
* Don't know.
|
|
|
|
*/
|
2023-04-21 02:23:13 +00:00
|
|
|
#[wasm_bindgen]
|
2023-04-21 13:25:21 +00:00
|
|
|
pub struct CoreResponse(kifu_core::Response);
|
2023-04-21 02:23:13 +00:00
|
|
|
|
|
|
|
#[wasm_bindgen]
|
2023-04-21 13:25:21 +00:00
|
|
|
#[derive(Debug)]
|
|
|
|
pub struct CoreApp;
|
2023-04-21 02:23:13 +00:00
|
|
|
|
|
|
|
#[wasm_bindgen]
|
2023-04-21 13:25:21 +00:00
|
|
|
impl CoreApp {
|
|
|
|
#[wasm_bindgen(constructor)]
|
|
|
|
pub fn new() -> Self {
|
|
|
|
Self
|
|
|
|
}
|
|
|
|
|
|
|
|
#[wasm_bindgen]
|
|
|
|
pub async fn dispatch(&self, param: &JsValue) {
|
|
|
|
log(&format!("disptach! {:?}", param));
|
|
|
|
}
|
2023-04-21 02:23:13 +00:00
|
|
|
}
|