Skip to content
This repository has been archived by the owner on Jan 30, 2025. It is now read-only.

Commit

Permalink
Add a new sync browser module
Browse files Browse the repository at this point in the history
  • Loading branch information
inancgumus committed Jun 7, 2024
1 parent 3e5df83 commit 3162ff0
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions browser/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ type (
tracesMetadata map[string]string
filePersister filePersister
testRunID string
isSync bool // remove later
}

// JSModule exposes the properties available to the JS script.
Expand Down Expand Up @@ -67,6 +68,17 @@ func New() *RootModule {
}
}

// NewSync returns a pointer to a new RootModule instance that maps the
// browser's business logic to the synchronous version of the module's
// JS API.
func NewSync() *RootModule {
return &RootModule{
PidRegistry: &pidRegistry{},
initOnce: &sync.Once{},
isSync: true,
}
}

// NewModuleInstance implements the k6modules.Module interface to return
// a new instance for each VU.
func (m *RootModule) NewModuleInstance(vu k6modules.VU) k6modules.Instance {
Expand Down

0 comments on commit 3162ff0

Please sign in to comment.