vm

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2021 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MainFuncType

type MainFuncType func([]interface{}) interface{}

type WrappedVm

type WrappedVm struct {
	Vm *goja.Runtime
	// contains filtered or unexported fields
}

func NewVm

func NewVm(script string) (*WrappedVm, error)

func NewVmAndLoad

func NewVmAndLoad(script string) (*WrappedVm, error)

func NewVmAndLoadWithFile added in v0.0.2

func NewVmAndLoadWithFile(jsFilename string) (*WrappedVm, error)

func (*WrappedVm) Load

func (v *WrappedVm) Load() error

执行脚本

func (*WrappedVm) RegisterModule

func (v *WrappedVm) RegisterModule(moduleName string, module interface{}) error

func (*WrappedVm) Run

func (v *WrappedVm) Run(args []interface{}) (interface{}, error)

执行脚本中的 main 函数

func (*WrappedVm) RunFunc

func (v *WrappedVm) RunFunc(funcName string, args []interface{}) (result interface{}, err error)

func (*WrappedVm) ToValue

func (v *WrappedVm) ToValue(i interface{}) goja.Value

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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