javascript

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2026 License: MIT Imports: 40 Imported by: 0

Documentation

Overview

Package javascript implements the page-scoped Growse JavaScript Runtime.

Index

Constants

View Source
const (
	MaxEventListeners = 20_000
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Runtime

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

Runtime is one JavaScript VM and serialized callback queue owned by a Page.

func New

func New() *Runtime

New returns an unloaded page-scoped JavaScript Runtime.

func (*Runtime) DispatchHashChange

func (runtime *Runtime) DispatchHashChange(oldURL, newURL string)

DispatchHashChange delivers a same-document fragment event on the Page queue.

func (*Runtime) DispatchMessage added in v0.14.0

func (runtime *Runtime) DispatchMessage(event runtimemodel.MessageEvent) error

DispatchMessage adds one message event to the serialized Page queue.

func (*Runtime) DispatchPageEvent

func (runtime *Runtime) DispatchPageEvent(callback func() bool) bool

DispatchPageEvent serializes a browser Event with JavaScript callbacks.

func (*Runtime) DispatchPopState

func (runtime *Runtime) DispatchPopState(state string)

DispatchPopState delivers a Browser history traversal on the Page queue and waits until listeners finish so the Browser can publish a stable mutation.

func (*Runtime) HasAnimationFrameCallbacks

func (runtime *Runtime) HasAnimationFrameCallbacks() bool

HasAnimationFrameCallbacks reports whether the Page requested another frame.

func (*Runtime) Load

func (runtime *Runtime) Load(ctx context.Context, scripts []runtimemodel.Script, environment runtimemodel.Environment) error

Load prepares a VM and host objects without evaluating Page scripts.

func (*Runtime) RunAnimationFrame

func (runtime *Runtime) RunAnimationFrame(current time.Time) bool

RunAnimationFrame synchronously delivers one browser frame on the Page queue.

func (*Runtime) SetBackground

func (runtime *Runtime) SetBackground(background bool)

SetBackground applies hidden-Tab scheduling policy to the Page.

func (*Runtime) Start

func (runtime *Runtime) Start(ctx context.Context) error

Start evaluates selected Page scripts according to classic script loading semantics and delivers the document lifecycle exactly once.

func (*Runtime) Stop

func (runtime *Runtime) Stop() error

Stop interrupts execution and releases all Page-owned host references.

func (*Runtime) UpdateFrames added in v0.14.0

func (runtime *Runtime) UpdateFrames(frames []runtimemodel.FrameAccess)

UpdateFrames replaces direct child access on the serialized Page queue.

func (*Runtime) UpdateLocation

func (runtime *Runtime) UpdateLocation(documentURL *url.URL)

UpdateLocation reflects a same-document Navigation in JavaScript location.

func (*Runtime) UpdateMediaEnvironment added in v0.15.0

func (runtime *Runtime) UpdateMediaEnvironment(media runtimemodel.MediaEnvironment)

UpdateMediaEnvironment re-evaluates live MediaQueryLists on the Page queue.

func (*Runtime) UpdateWindow added in v0.14.0

func (runtime *Runtime) UpdateWindow(context runtimemodel.WindowContext)

UpdateWindow refreshes parent, top, and child WindowProxy relationships.

Jump to

Keyboard shortcuts

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