Help us shape the future of Go! Take the 2026 Go Developer Survey

javascript

package
v0.27.1 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2024 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Package javascript provides the javascript runtime for the application.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compile

func Compile(path string) (*goja.Program, error)

func CompileScript

func CompileScript(name, script string) (*goja.Program, error)

func SetAll

func SetAll(s setter, defs ...ObjectValueDef) error

Types

type APIAdder

type APIAdder interface {
	AddToVM(globalName string, vm *VM) error
}

type GQL

type GQL struct {
	Context    context.Context
	Cookie     *http.Cookie
	GQLHandler http.Handler
}

func (*GQL) AddToVM

func (g *GQL) AddToVM(globalName string, vm *VM) error

type Log

type Log struct {
	// Logger is the LoggerImpl to forward log messages to.
	Logger logger.LoggerImpl
	// Prefix is the prefix to prepend to log messages.
	Prefix string
	// ProgressChan is a channel that receives float64s indicating the current progress of an operation.
	ProgressChan chan float64
}

Log provides log wrappers for usable from the JS VM.

func (*Log) AddToVM

func (l *Log) AddToVM(globalName string, vm *VM) error

type ObjectValueDef

type ObjectValueDef struct {
	Name  string
	Value interface{}
}

type Util

type Util struct{}

func (*Util) AddToVM

func (u *Util) AddToVM(globalName string, vm *VM) error

type VM

type VM struct {
	*goja.Runtime
}

VM is a wrapper around goja.Runtime.

func NewVM

func NewVM() *VM

func (*VM) Throw

func (v *VM) Throw(err error)

Jump to

Keyboard shortcuts

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