pub trait JsObserve: DynClone {
// Required methods
fn get_js(&self) -> JsValue;
fn unsubscribe(&self, handle: ListenerHandle) -> bool;
fn subscribe(&self, cb: Box<dyn Fn(JsValue)>) -> ListenerHandle;
fn once(&self, cb: Box<dyn Fn(JsValue)>) -> ListenerHandle;
// Provided method
fn map_js(&self, cb: Function) -> JsValue { ... }
}
Expand description
This trait is necessary to support generic observables which cannot themselves be exportable via wasm_bindgen