Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrStopPropagation = errors.New("event hook propagation stopped")
Functions ¶
This section is empty.
Types ¶
type Hook ¶
type Hook[T any] struct { // contains filtered or unexported fields }
Event hooks store
concurrent safe structure, aka. callbacks propagation
func (*Hook[T]) Trigger ¶
Trigger executes all registered hook handlers one by one with the specified `data` as an argument
Optionally, this method allows also to register additional one off handlers that will be temporary appended to the handlers queue
The execution stops when: - hook.ErrStopPropagation is returned in one of the handlers - any non-nil error is returned in one of the handlers
Click to show internal directories.
Click to hide internal directories.