vm

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package vm provides a wrapper around the goja runtime.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrCompilation is returned when a script fails to compile.
	ErrCompilation = errors.New("script compilation failed")
	// ErrRuntime is returned when a script fails to run.
	ErrRuntime = errors.New("script runtime failure")
)

Functions

This section is empty.

Types

type VM

type VM struct {
	*goja.Runtime
}

VM is a wrapper around the goja runtime.

func New

func New() (*VM, error)

New creates a new VM.

func (*VM) Run

func (v *VM) Run(name string, src string) (goja.Value, error)

Run runs a script in the VM.

func (*VM) ToObject

func (v *VM) ToObject(val goja.Value) *goja.Object

ToObject converts a value to an object.

Jump to

Keyboard shortcuts

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