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
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 Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".