xk6-template-javascript
ˮsummaryˮ
Example
import globalˮPrimaryClassˮ, { ˮPrimaryClassˮ } from "k6/x/ˮnameˮ"
export default function () {
console.log(globalˮPrimaryClassˮ.greeting)
let instance = new ˮPrimaryClassˮ("Wonderful World")
console.log(instance.greeting)
}
The examples directory contains examples of how to use the xk6-template-javascript extension. A k6 binary containing the xk6-template-javascript extension is required to run the examples. If the search path also contains the k6 command, don't forget to specify which k6 you want to run (for example ./k6
).
Build
The xk6 build tool can be used to build a k6 that will include xk6-template-javascript extension:
$ xk6 build --with github.com/szkiba/xk6-template-javascript@latest
For more build options and how to use xk6, check out the xk6 documentation.
API
ˮPrimaryClassˮ
This is the primary class of the ˮnameˮ extension.
Example
import { ˮPrimaryClassˮ } from "k6/x/ˮnameˮ"
export default function () {
let instance = new ˮPrimaryClassˮ("Wonderful World")
console.log(instance.greeting)
}
ˮPrimaryClassˮ()
constructor(name: string);
name
to whom the greeting is addressed
Create a new ˮPrimaryClassˮ instance.
ˮPrimaryClassˮ.greeting
readonly greeting: string;
Greeting message