From 1e480c53809aea41d2ca53ce01917b9c24265411 Mon Sep 17 00:00:00 2001 From: Gani Georgiev Date: Mon, 7 Oct 2024 09:59:10 +0300 Subject: [PATCH] renamed Trigger arg to avoid confusion with the Handler type --- tools/hook/hook.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/hook/hook.go b/tools/hook/hook.go index f7e796ee..2c68b70e 100644 --- a/tools/hook/hook.go +++ b/tools/hook/hook.go @@ -145,16 +145,16 @@ func (h *Hook[T]) Length() int { // with the specified event as an argument. // // Optionally, this method allows also to register additional one off -// handlers that will be temporary appended to the handlers queue. +// handler funcs that will be temporary appended to the handlers queue. // // NB! Each hook handler must call event.Next() in order the hook chain to proceed. -func (h *Hook[T]) Trigger(event T, oneOffHandlers ...func(T) error) error { +func (h *Hook[T]) Trigger(event T, oneOffHandlerFuncs ...func(T) error) error { h.mu.RLock() - handlers := make([]func(T) error, 0, len(h.handlers)+len(oneOffHandlers)) + handlers := make([]func(T) error, 0, len(h.handlers)+len(oneOffHandlerFuncs)) for _, handler := range h.handlers { handlers = append(handlers, handler.Func) } - handlers = append(handlers, oneOffHandlers...) + handlers = append(handlers, oneOffHandlerFuncs...) h.mu.RUnlock() event.setNextFunc(nil) // reset in case the event is being reused