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

browser

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: BSD-3-Clause Imports: 1 Imported by: 0

Documentation

Overview

Package browser is the Executor for GOOS=js: each container process runs in its own Web Worker (worker.js), its wasi_snapshot_preview1 imports served synchronously by the engine's WASI host (package wasi) in the worker that runs the engine, over SharedArrayBuffer and Atomics.wait.

The page must be cross-origin isolated (COOP same-origin, COEP require-corp) for SharedArrayBuffer and shared WebAssembly memories.

Index

Constants

This section is empty.

Variables

View Source
var WorkerJS []byte

WorkerJS is the container worker script, to be served same-origin at the URL given to the executor.

Functions

This section is empty.

Types

type Executor

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

Executor runs each container process in a Web Worker.

func New

func New(opt Options) *Executor

New returns an executor.

func (*Executor) CacheLen

func (e *Executor) CacheLen() int

CacheLen reports how many compiled modules are cached.

func (*Executor) Close

func (e *Executor) Close(context.Context) error

Close implements runtime.Executor.

func (*Executor) Start

func (e *Executor) Start(ctx context.Context, spec runtime.Spec) (runtime.Process, error)

Start implements runtime.Executor.

type Options

type Options struct {
	// WorkerURL is where worker.js (WorkerJS) is served, same origin.
	WorkerURL string
	// DefaultMemoryLimitBytes applies when a Spec sets none (256 MiB).
	DefaultMemoryLimitBytes int64
	// MaxCompiled bounds the compiled-module cache (default 32).
	MaxCompiled int
}

Options configures the executor.

Jump to

Keyboard shortcuts

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