#[doc(hidden)]
pub use wasm_bindgen as bindgen;
#[macro_export]
macro_rules! export_wasm_core {
($app:ty) => {
#[$crate::wasm::bindgen::prelude::wasm_bindgen(wasm_bindgen = $crate::wasm::bindgen)]
pub struct Core {
inner: $crate::Runtime<$app>,
}
#[$crate::wasm::bindgen::prelude::wasm_bindgen(wasm_bindgen = $crate::wasm::bindgen)]
impl Core {
#[wasm_bindgen(constructor)]
#[must_use]
pub fn new(boot: &[u8]) -> Core {
Core {
inner: $crate::Runtime::<$app>::new(boot),
}
}
pub fn dispatch(&mut self, input: &[u8]) -> Vec<u8> {
$crate::Bridge::dispatch(&mut self.inner, input)
}
pub fn pointer(&mut self, phase: u8, x: f32, y: f32, at_ms: f64) -> u32 {
$crate::Bridge::pointer(&mut self.inner, phase, x, y, at_ms)
}
#[must_use]
pub fn view(&self, key: &str) -> Vec<u8> {
$crate::Bridge::view(&self.inner, key)
}
pub fn provide_blob(&mut self, name: &str, bytes: &[u8]) -> Vec<u8> {
$crate::Bridge::provide_blob(&mut self.inner, name, bytes)
}
}
#[$crate::wasm::bindgen::prelude::wasm_bindgen(wasm_bindgen = $crate::wasm::bindgen)]
#[must_use]
pub fn bridge_protocol() -> u32 {
u32::try_from($crate::BRIDGE_PROTOCOL).unwrap_or(0)
}
};
}