js

package
v0.0.0-...-d08e724 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Panic

func Panic(rt *goja.Runtime, err error)

Types

type Class

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

func NewClass

func NewClass(vm *goja.Runtime, constructor goja.Callable, prototype *goja.Object) *Class

func (*Class) Instantiate

func (c *Class) Instantiate(params ...interface{}) error

Instantiate calls the constructor with the supplied arguments

func (*Class) Invoke

func (c *Class) Invoke(fnName string, result interface{}, params ...interface{}) error

func (*Class) InvokeVoid

func (c *Class) InvokeVoid(fnName string, params ...interface{}) error

func (*Class) This

func (c *Class) This() *goja.Object

type Compiler

type Compiler struct {
	TransformFunc goja.Callable
	// contains filtered or unexported fields
}

func NewCompiler

func NewCompiler() (*Compiler, error)

func (*Compiler) Compile

func (c *Compiler) Compile(source string, filename string, main bool) (*goja.Program, error)

type Exports

type Exports struct {
	Default interface{}
	Named   map[string]interface{}
}

type Instance

type Instance interface {
	Exports() Exports
}

type Module

type Module interface {
	Register(runtime *goja.Runtime) error
	NewModuleInstance(runtime *goja.Runtime) Instance
}

type Runtime

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

func NewRuntime

func NewRuntime(source string, sourceFile string) *Runtime

func (*Runtime) Close

func (r *Runtime) Close() error

func (*Runtime) Compile

func (r *Runtime) Compile() error

func (*Runtime) CreateObject

func (r *Runtime) CreateObject() *goja.Object

func (*Runtime) Execute

func (r *Runtime) Execute() error

func (*Runtime) GetDefaultExport

func (r *Runtime) GetDefaultExport() (*Class, error)

func (*Runtime) GetRuntime

func (r *Runtime) GetRuntime() *goja.Runtime

func (*Runtime) PanicError

func (r *Runtime) PanicError(error string)

func (*Runtime) RegisterModule

func (r *Runtime) RegisterModule(s string, m Module) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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