v8host

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: May 27, 2025 License: MIT Imports: 30 Imported by: 0

Documentation

Overview

The v8host packages provides functionality to execute client-side scripts in gost-dom. The engine uses v8, and requires cgo.

This engine is based on tommie's v8go form, which automatically pulls the latest v8 changes from the chromium repo.

An alternate script engine that is implemented in pure go is found in the gojahost package

See also: https://github.com/tommie/v8go

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrIncompatibleType   = errors.New("Incompatible type")
	ErrWrongNoOfArguments = errors.New("Not enough arguments passed")
)

Functions

This section is empty.

Types

type HostOption added in v0.5.1

type HostOption func(o *hostOptions)

func WithLogger added in v0.5.1

func WithLogger(logger log.Logger) HostOption

type Keys added in v0.6.0

type Keys[K, V any] struct {
	// contains filtered or unexported fields
}

func (Keys[K, V]) All added in v0.6.0

func (k Keys[K, V]) All() iter.Seq[K]

type MutationCallback added in v0.6.0

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

func (MutationCallback) HandleMutation added in v0.6.0

func (cb MutationCallback) HandleMutation(recs []mutation.Record, obs *mutation.Observer)

type V8Script added in v0.7.0

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

func (V8Script) Eval added in v0.7.0

func (s V8Script) Eval() (any, error)

func (V8Script) Run added in v0.7.0

func (s V8Script) Run() error

type V8ScriptContext

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

func (*V8ScriptContext) Clock added in v0.3.0

func (ctx *V8ScriptContext) Clock() html.Clock

func (*V8ScriptContext) Close

func (ctx *V8ScriptContext) Close()

func (*V8ScriptContext) Compile added in v0.7.0

func (ctx *V8ScriptContext) Compile(script string) (V8Script, error)

func (*V8ScriptContext) Eval

func (ctx *V8ScriptContext) Eval(script string) (any, error)

func (*V8ScriptContext) Run

func (ctx *V8ScriptContext) Run(script string) error

type V8ScriptHost

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

func New

func New(opts ...HostOption) *V8ScriptHost

func (*V8ScriptHost) Close

func (host *V8ScriptHost) Close()

func (*V8ScriptHost) Logger added in v0.5.1

func (host *V8ScriptHost) Logger() log.Logger

func (*V8ScriptHost) NewContext

func (host *V8ScriptHost) NewContext(w html.Window) html.ScriptContext

NewContext creates a new script context using w as the global window object. Calling with a nil value for w is allowed, but not supported; and any attempt to access the DOM will result in a runtime error.

Jump to

Keyboard shortcuts

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