From 5c3e2fddaf18feac6751bd98dcbfbed0a4a91184 Mon Sep 17 00:00:00 2001 From: Ankur Date: Thu, 6 Oct 2022 11:50:10 +0100 Subject: [PATCH] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: İnanç Gümüş --- common/event_emitter.go | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/common/event_emitter.go b/common/event_emitter.go index 13726d8ac..46e13c592 100644 --- a/common/event_emitter.go +++ b/common/event_emitter.go @@ -100,9 +100,9 @@ type NavigationEvent struct { type eventHandler struct { ctx context.Context ch chan Event - queueMutex *sync.Mutex + queueMutex sync.Mutex queue []Event - curQueueMutex *sync.Mutex + curQueueMutex sync.Mutex curQueue []Event } @@ -242,14 +242,6 @@ func (e *BaseEventEmitter) on(ctx context.Context, events []string, ch chan Even // OnAll registers a handler for all events. func (e *BaseEventEmitter) onAll(ctx context.Context, ch chan Event) { e.sync(func() { - e.handlersAll = append(e.handlersAll, - &eventHandler{ - ctx, - ch, - &sync.Mutex{}, - make([]Event, 0), - &sync.Mutex{}, - make([]Event, 0), - }) + e.handlersAll = append(e.handlersAll, &eventHandler{ctx: ctx, ch: ch}) }) }