Skip to main content

Module hooks

Module hooks 

Source
Expand description

Lifecycle hooks: one place to observe every mount, update, and action.

An application registers a callback once, and the pipeline calls it at each step. Upstream spells this Livewire::hook('mounted', …); here one callback matches on HookEvent, so a hook that only cares about calls needs no registration per event.

registry.hook(|event| {
    if let HookEvent::Mount { name, id } = event {
        println!("{name} mounted as {id}");
    }
});

Structs§

Hooks
The hooks an application registered, run in registration order.

Enums§

HookEvent
One step of a component’s life, borrowed for the length of the call that ran it.

Type Aliases§

HookCallback
A callback an application registers once.