gojs

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2024 License: MIT Imports: 16 Imported by: 2

README

gojs

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExportForDev added in v0.1.0

func ExportForDev() string

func FindPath added in v0.1.0

func FindPath(vm *goja.Runtime, filename string) string

func GetFunc added in v0.1.0

func GetFunc(v goja.Value) goja.Callable

func GetLogger added in v0.1.0

func GetLogger(vm *goja.Runtime) *log.Logger

func Register added in v0.1.0

func Register(name string, mod Module)

func Run

func Run(code string, refFile string, args ...any) (any, error)

func RunFile

func RunFile(file string, args ...any) (any, error)

Types

type Args added in v0.1.0

type Args struct {
	This      goja.Value
	Arguments []goja.Value
	VM        *goja.Runtime
	Logger    *log.Logger
}

func MakeArgs added in v0.1.0

func MakeArgs(args *goja.FunctionCall, vm *goja.Runtime) *Args

func (*Args) Any added in v0.1.0

func (args *Args) Any(index int) any

func (*Args) Arr added in v0.1.0

func (args *Args) Arr(startIndex int) []any

func (*Args) Bool added in v0.1.0

func (args *Args) Bool(index int) bool

func (*Args) Bytes added in v0.1.0

func (args *Args) Bytes(index int) []byte

func (*Args) Check added in v0.1.0

func (args *Args) Check(num int) *Args

func (*Args) Func added in v0.1.0

func (args *Args) Func(index int) goja.Callable

func (*Args) Int added in v0.1.0

func (args *Args) Int(index int) int

func (*Args) Int64 added in v0.1.0

func (args *Args) Int64(index int) int64

func (*Args) Map added in v0.1.0

func (args *Args) Map(index int) map[string]any

func (*Args) Map2Arr added in v0.1.0

func (args *Args) Map2Arr(index int) []any

func (*Args) Map2StrArr added in v0.1.0

func (args *Args) Map2StrArr(index int) []string

func (*Args) Obj added in v0.1.0

func (args *Args) Obj(index int) *goja.Object

func (*Args) Path added in v0.1.0

func (args *Args) Path(index int) string

func (*Args) Str added in v0.1.0

func (args *Args) Str(index int) string

func (*Args) StrArr added in v0.1.0

func (args *Args) StrArr(startIndex int) []string

type Map added in v0.1.0

type Map = map[string]any

type Module added in v0.1.0

type Module struct {
	Object      Map
	ObjectMaker func(vm *goja.Runtime) Map
	TsCode      string
	Desc        string
	Example     string
}

type Runtime added in v0.1.0

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

func New

func New() *Runtime

func (*Runtime) GetCallStack added in v0.1.0

func (rt *Runtime) GetCallStack() []string

func (*Runtime) GetGoData added in v0.1.0

func (rt *Runtime) GetGoData(name string) any

func (*Runtime) RunCode added in v0.1.0

func (rt *Runtime) RunCode(code string) (any, error)

func (*Runtime) RunMain added in v0.1.0

func (rt *Runtime) RunMain(args ...any) (any, error)

func (*Runtime) Set added in v0.1.0

func (rt *Runtime) Set(name string, value any) error

func (*Runtime) SetGlobal added in v0.1.0

func (rt *Runtime) SetGlobal(global Map) error

func (*Runtime) SetGoData added in v0.1.0

func (rt *Runtime) SetGoData(name string, value any)

func (*Runtime) SetModuleLoader added in v0.1.0

func (rt *Runtime) SetModuleLoader(fn func(filename string) string)

func (*Runtime) StartFromCode added in v0.1.0

func (rt *Runtime) StartFromCode(code, refFile string) error

func (*Runtime) StartFromFile added in v0.1.0

func (rt *Runtime) StartFromFile(file string) error

type WatchRunner added in v0.1.0

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

func WatchRun added in v0.1.0

func WatchRun(file string, extDirs, extTypes []string, args ...any) (*WatchRunner, error)

func (*WatchRunner) Stop added in v0.1.0

func (wr *WatchRunner) Stop()

func (*WatchRunner) WaitForKill added in v0.1.0

func (wr *WatchRunner) WaitForKill()

Directories

Path Synopsis
dop251
base64dec
Package base64dec contains a universal base64 decoder that works on both the standard and url-safe variants, padded and raw.
Package base64dec contains a universal base64 decoder that works on both the standard and url-safe variants, padded and raw.
goja/ast
Package ast declares types representing a JavaScript AST.
Package ast declares types representing a JavaScript AST.
goja/file
Package file encapsulates the file abstractions used by the ast & parser.
Package file encapsulates the file abstractions used by the ast & parser.
goja/ftoa
Package ftoa provides ECMAScript-compliant floating point number conversion to string.
Package ftoa provides ECMAScript-compliant floating point number conversion to string.
goja/ftoa/internal/fast
Package fast contains code ported from V8 (https://github.com/v8/v8/blob/master/src/numbers/fast-dtoa.cc)
Package fast contains code ported from V8 (https://github.com/v8/v8/blob/master/src/numbers/fast-dtoa.cc)
goja/goja command
goja/parser
Package parser implements a parser for JavaScript.
Package parser implements a parser for JavaScript.
goja/token
Package token defines constants representing the lexical tokens of JavaScript (ECMA5).
Package token defines constants representing the lexical tokens of JavaScript (ECMA5).
goja/unistring
Package unistring contains an implementation of a hybrid ASCII/UTF-16 string.
Package unistring contains an implementation of a hybrid ASCII/UTF-16 string.

Jump to

Keyboard shortcuts

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