Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

js/modules: update docs around NewModuleInstance #4076

Merged
merged 1 commit into from
Nov 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions js/modules/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"strings"

"github.com/grafana/sobek"

"go.k6.io/k6/ext"
"go.k6.io/k6/js/common"
"go.k6.io/k6/lib"
Expand All @@ -27,8 +28,8 @@ func Register(name string, mod interface{}) {

// Module is the interface js modules should implement in order to get access to the VU
type Module interface {
// NewModuleInstance will get modules.VU that should provide the module with a way to interact with the VU
// This method will be called for *each* require/import and should return an unique instance for each call
// NewModuleInstance will get modules.VU that should provide the module with a way to interact with the VU.
// This method will be called for *each* VU that imports the module *once* per that VU.
NewModuleInstance(VU) Instance
}

Expand Down
Loading