Bind registers the provided handler to the current hooks queue. It is similar to [Hook.Bind] with the difference that the handler function is invoked only if the event data tags satisfy h.CanTriggerOn.
(handler *Handler[T])
| 56 | // It is similar to [Hook.Bind] with the difference that the handler |
| 57 | // function is invoked only if the event data tags satisfy h.CanTriggerOn. |
| 58 | func (h *TaggedHook[T]) Bind(handler *Handler[T]) string { |
| 59 | fn := handler.Func |
| 60 | |
| 61 | handler.Func = func(e T) error { |
| 62 | if h.CanTriggerOn(e.Tags()) { |
| 63 | return fn(e) |
| 64 | } |
| 65 | |
| 66 | return e.Next() |
| 67 | } |
| 68 | |
| 69 | return h.mainHook.Bind(handler) |
| 70 | } |
| 71 | |
| 72 | // BindFunc registers a new handler with the specified function. |
| 73 | // |
nothing calls this directly
no test coverage detected