pub struct ContextEventManager { /* private fields */ }Expand description
Context event manager that handles all context-level events.
Implementations§
Source§impl ContextEventManager
impl ContextEventManager
Sourcepub async fn on_page<F, Fut>(&self, handler: F) -> HandlerId
pub async fn on_page<F, Fut>(&self, handler: F) -> HandlerId
Register a handler for new page events.
The handler will be called whenever a new page is created in the context. Returns a handler ID that can be used to remove the handler.
Sourcepub async fn off_page(&self, id: HandlerId) -> bool
pub async fn off_page(&self, id: HandlerId) -> bool
Remove a page event handler by its ID.
Returns true if a handler was removed.
Sourcepub async fn on_close<F, Fut>(&self, handler: F) -> HandlerId
pub async fn on_close<F, Fut>(&self, handler: F) -> HandlerId
Register a handler for context close events.
The handler will be called when the context is about to close. Returns a handler ID that can be used to remove the handler.
Sourcepub async fn off_close(&self, id: HandlerId) -> bool
pub async fn off_close(&self, id: HandlerId) -> bool
Remove a close event handler by its ID.
Returns true if a handler was removed.
Sourcepub async fn emit_close(&self)
pub async fn emit_close(&self)
Emit a close event to all registered handlers.
Trait Implementations§
Source§impl Default for ContextEventManager
impl Default for ContextEventManager
Source§fn default() -> ContextEventManager
fn default() -> ContextEventManager
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !Freeze for ContextEventManager
impl !RefUnwindSafe for ContextEventManager
impl Send for ContextEventManager
impl Sync for ContextEventManager
impl Unpin for ContextEventManager
impl !UnwindSafe for ContextEventManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more