worker

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package worker provides the typego:worker module for multi-threading.

Index

Constants

This section is empty.

Variables

View Source
var Types []byte

Functions

func Register

func Register(vm *goja.Runtime, el *eventloop.EventLoop, spawner Spawner)

Register injects the typego:worker module into the runtime.

func RegisterSelf

func RegisterSelf(vm *goja.Runtime, postToParent func(msg goja.Value))

RegisterSelf registers the 'self' object in a worker thread.

Types

type Handle

type Handle interface {
	PostMessage(msg goja.Value)
	Terminate()
}

Handle represents a running worker.

type Spawner

type Spawner func(scriptPath string, onMessage func(goja.Value)) (Handle, error)

Spawner is a function that creates a new worker.

Jump to

Keyboard shortcuts

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