vm

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2023 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 NewVmWithFile added in v0.1.2

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

func (*WrappedVm) Logger added in v0.1.2

func (v *WrappedVm) Logger() go_logger.InterfaceLogger

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) SetLogger added in v0.1.2

func (v *WrappedVm) SetLogger(logger go_logger.InterfaceLogger) *WrappedVm

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