You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: helpers.go
    path of file: ./repos/playwright-go
    
    the code of the file until where you have to start completion: package playwright

import (
	"fmt"
	"path"
	"reflect"
	"regexp"
	"strings"
	"sync"
	"sync/atomic"

	mapset "github.com/deckarep/golang-set/v2"
)

type (
	routeHandler = func(Route)
)

func skipFieldSerialization(val reflect.Value) bool {
	typ := val.Type()
	return (typ.Kind() == reflect.Ptr ||
		typ.Kind() == reflect.Interface ||
		typ.Kind() == reflect.Map ||
		typ.Kind() == reflect.Slice)
    
func (r *routeHandlerEntry) Stop(behavior string) {
	// When a handler is manually unrouted or its page/context is closed we either
	// - wait for the current handler invocations to finish
	// - or do not wait, if the user opted out of it, but swallow all exceptions
	//   that happen after the unroute/close.
	if behavior == string(*UnrouteBehaviorIgnoreErrors) {
		r.ignoreErrors.Store(true)
	} else {
		wg := &sync.WaitGroup{}
		r.activeInvocations.Each(func(activation *routeHandlerInvocation) bool {
			if !activation.route.(*routeImpl).didThrow {
				wg.Add(1)
				go func(complete chan bool) {
					<-complete
					wg.Done()
				}(activation.complete)
			}
			return false
		})
		wg.Wait()
	}
}