pub struct LifecycleManager { /* private fields */ }Expand description
Manager for widget lifecycle hooks.
Implementations§
Source§impl LifecycleManager
impl LifecycleManager
Sourcepub fn register(
&mut self,
widget_id: WidgetId,
phases: Vec<LifecyclePhase>,
callback: LifecycleCallback,
) -> HookId
pub fn register( &mut self, widget_id: WidgetId, phases: Vec<LifecyclePhase>, callback: LifecycleCallback, ) -> HookId
Register a lifecycle hook.
Returns a hook ID that can be used to unregister the hook.
Sourcepub fn on_mount(
&mut self,
widget_id: WidgetId,
callback: LifecycleCallback,
) -> HookId
pub fn on_mount( &mut self, widget_id: WidgetId, callback: LifecycleCallback, ) -> HookId
Register a mount hook.
Sourcepub fn on_unmount(
&mut self,
widget_id: WidgetId,
callback: LifecycleCallback,
) -> HookId
pub fn on_unmount( &mut self, widget_id: WidgetId, callback: LifecycleCallback, ) -> HookId
Register an unmount hook.
Sourcepub fn on_update(
&mut self,
widget_id: WidgetId,
callback: LifecycleCallback,
) -> HookId
pub fn on_update( &mut self, widget_id: WidgetId, callback: LifecycleCallback, ) -> HookId
Register an update hook.
Sourcepub fn on_focus(
&mut self,
widget_id: WidgetId,
callback: LifecycleCallback,
) -> HookId
pub fn on_focus( &mut self, widget_id: WidgetId, callback: LifecycleCallback, ) -> HookId
Register a focus hook.
Sourcepub fn on_blur(
&mut self,
widget_id: WidgetId,
callback: LifecycleCallback,
) -> HookId
pub fn on_blur( &mut self, widget_id: WidgetId, callback: LifecycleCallback, ) -> HookId
Register a blur hook.
Sourcepub fn unregister(&mut self, hook_id: HookId) -> bool
pub fn unregister(&mut self, hook_id: HookId) -> bool
Unregister a hook.
Sourcepub fn unregister_widget(&mut self, widget_id: WidgetId)
pub fn unregister_widget(&mut self, widget_id: WidgetId)
Unregister all hooks for a widget.
Sourcepub fn emit(&mut self, widget_id: WidgetId, phase: LifecyclePhase)
pub fn emit(&mut self, widget_id: WidgetId, phase: LifecyclePhase)
Emit a lifecycle event immediately.
Sourcepub fn queue(&mut self, widget_id: WidgetId, phase: LifecyclePhase)
pub fn queue(&mut self, widget_id: WidgetId, phase: LifecyclePhase)
Queue a lifecycle event for later dispatch.
Sourcepub fn pending_count(&self) -> usize
pub fn pending_count(&self) -> usize
Get the number of pending events.
Sourcepub fn hook_count(&self) -> usize
pub fn hook_count(&self) -> usize
Get the number of registered hooks.