js2

package
v0.12.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 12, 2017 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bundle

type Bundle struct {
	Filename string
	Program  *goja.Program
	Options  lib.Options

	BaseInitContext *InitContext
}

A Bundle is a self-contained bundle of scripts and resources. You can use this to produce identical BundleInstance objects.

func NewBundle

func NewBundle(src *lib.SourceData, fs afero.Fs) (*Bundle, error)

Creates a new bundle from a source file and a filesystem.

func (*Bundle) Instantiate

func (b *Bundle) Instantiate() (*BundleInstance, error)

Instantiates a new runtime from this bundle.

type BundleInstance

type BundleInstance struct {
	Runtime *goja.Runtime
	Context *context.Context
	Default goja.Callable
}

A BundleInstance is a self-contained instance of a Bundle.

type Console

type Console struct {
	Logger *log.Logger
}

func NewConsole

func NewConsole() *Console

func (Console) Debug

func (c Console) Debug(msg goja.Value, args ...goja.Value)

func (Console) Error

func (c Console) Error(msg goja.Value, args ...goja.Value)

func (Console) Info

func (c Console) Info(msg goja.Value, args ...goja.Value)

func (Console) Log

func (c Console) Log(msg goja.Value, args ...goja.Value)

func (Console) Warn

func (c Console) Warn(msg goja.Value, args ...goja.Value)

type InitContext

type InitContext struct {

	// Console object.
	Console *Console
	// contains filtered or unexported fields
}

Provides APIs for use in the init context.

func NewInitContext

func NewInitContext(rt *goja.Runtime, ctxPtr *context.Context, fs afero.Fs, pwd string) *InitContext

func (*InitContext) Open

func (i *InitContext) Open(name string) (string, error)

func (*InitContext) Require

func (i *InitContext) Require(arg string) goja.Value

type Runner

type Runner struct {
	Bundle *Bundle
	// contains filtered or unexported fields
}

func New

func New(src *lib.SourceData, fs afero.Fs) (*Runner, error)

func (*Runner) ApplyOptions

func (r *Runner) ApplyOptions(opts lib.Options)

func (*Runner) GetDefaultGroup

func (r *Runner) GetDefaultGroup() *lib.Group

func (*Runner) GetOptions

func (r *Runner) GetOptions() lib.Options

func (*Runner) NewVU

func (r *Runner) NewVU() (lib.VU, error)

type VU

type VU struct {
	BundleInstance

	Runner    *Runner
	ID        int64
	Iteration int64

	VUContext *VUContext
}

func (*VU) Reconfigure

func (u *VU) Reconfigure(id int64) error

func (*VU) RunOnce

func (u *VU) RunOnce(ctx context.Context) ([]stats.Sample, error)

type VUContext

type VUContext struct {
	// Console Object.
	Console *Console `js:"console"`
}

Provides APIs and state for use in a VU context.

func NewVUContext

func NewVUContext() *VUContext

Directories

Path Synopsis
k6

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL