dsljavascript

package
v3.21.0 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

Package dsljavascript allows running experiments written in JavaScript.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunScript

func RunScript(config *VMConfig, scriptPath string) error

RunScript runs the given script using a transient VM.

Types

type VM

type VM struct {
	// contains filtered or unexported fields
}

VM wraps the *github.com/dop251/goja.Runtime. The zero value of this struct is invalid; please, use NewVM to construct.

func LoadExperiment

func LoadExperiment(config *VMConfig, exPath string) (*VM, error)

LoadExperiment loads the given experiment file and returns a new VM primed to execute the experiment several times for several inputs.

func NewVM

func NewVM(config *VMConfig, scriptPath string) (*VM, error)

NewVM creates a new VM instance.

func (*VM) ExperimentName

func (vm *VM) ExperimentName() (string, error)

ExperimentName returns the experiment name. Invoking this method before invoking LoadScript always produces an error.

func (*VM) ExperimentVersion

func (vm *VM) ExperimentVersion() (string, error)

ExperimentVersion returns the experiment version. Invoking this method before invoking LoadScript always produces an error.

func (*VM) Run

func (vm *VM) Run(input string) (string, error)

Run performs a measurement and returns the test keys.

func (*VM) RunScript

func (vm *VM) RunScript(exPath string) error

type VMConfig

type VMConfig struct {
	// Logger is the MANDATORY logger to use.
	Logger model.Logger

	// ScriptBaseDir is the MANDATORY script base dir to use.
	ScriptBaseDir string
}

VMConfig contains configuration for creating a VM.

Jump to

Keyboard shortcuts

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