Skip to content

Commit

Permalink
Explain mapPageOn behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
inancgumus committed Oct 10, 2024
1 parent 687337b commit 503c4dd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion browser/page_mapping.go
Original file line number Diff line number Diff line change
Expand Up @@ -445,14 +445,16 @@ func mapPageOn(vu moduleVU, p *common.Page) func(common.PageOnEventName, sobek.C
return fmt.Errorf("unknown page on event: %q", eventName)
}

// Prepare the environment for the page.on event handler if necessary.
if pageOnEvent.prep != nil {
if err := pageOnEvent.prep(); err != nil {
return fmt.Errorf("initiating page.on('%s'): %w", eventName, err)
}
}

// Queue the event handler in the task queue.
// Wait for the handler to complete if necessary.
tq := vu.taskQueueRegistry.get(vu.Context(), p.TargetID())

queueHandler := func(event common.PageOnEvent) {
done := make(chan struct{})

Expand Down

0 comments on commit 503c4dd

Please sign in to comment.