BindFunc is similar to Bind but registers a new handler from just the provided function. The registered handler is added with a default 0 priority and the id will be autogenerated. If you want to register a handler with custom priority or id use the [Hook.Bind] method.
(fn func(e T) error)
| 109 | // |
| 110 | // If you want to register a handler with custom priority or id use the [Hook.Bind] method. |
| 111 | func (h *Hook[T]) BindFunc(fn func(e T) error) string { |
| 112 | return h.Bind(&Handler[T]{Func: fn}) |
| 113 | } |
| 114 | |
| 115 | // Unbind removes one or many hook handler by their id. |
| 116 | func (h *Hook[T]) Unbind(idsToRemove ...string) { |