interpreter

package
v0.0.0-...-04ff805 Latest Latest
Warning

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

Go to latest
Published: May 22, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Callable

type Callable func(args ...any) ([]gany.Val, error)

Callable represents a JavaScript function that can be called from Go.

type Vm

type Vm interface {
	// RunScript runs script.
	RunScript(script string) (gany.Val, error)

	// MapGoValueToScript allows script to access go runtime `value` with `name`.
	// Usually `value` is a pointer in the go runtime.
	MapGoValueToScript(name string, value interface{}) error

	// MapScriptFuncToGo allows go runtime to access script function.
	MapScriptFuncToGo(funcName string) (Callable, error)
}

Vm is script interpreter.

func NewVM

func NewVM(engine string) (Vm, error)

NewVM creates interpreter. It supports Golang script and ECMAScript languages like Javascript, TypeScripts.

Jump to

Keyboard shortcuts

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