Documentation
¶
Overview ¶
Package bridge provides the JavaScript-to-Go binding layer for the TypeGo runtime.
Bridge exposes Go functionality to the JavaScript environment running inside Goja. It is organized into three main areas:
- bridge/core: Low-level binding primitives and shared types.
- bridge/modules: Standard Go library bindings (go:fmt, go:os, go:net/http).
- bridge/stdlib: TypeGo-specific standard library (typego:memory, typego:worker).
Internal Registration ¶
Standard library modules in bridge/modules use a self-registration mechanism via init() functions and bridge/core.RegisterModule. TypeGo-specific modules are typically registered manually during engine initialization.
Shared Memory ¶
TypeGo provides high-performance shared memory between the main thread and workers via the typego:memory module.
Worker Support ¶
Background workers are supported via the typego:worker module, enabling multi-threaded JavaScript execution with postMessage communication.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package core provides internal utilities for the TypeGo bridge layer.
|
Package core provides internal utilities for the TypeGo bridge layer. |
|
modules
|
|
|
crypto
Package crypto provides bindings for Go's crypto packages.
|
Package crypto provides bindings for Go's crypto packages. |
|
fmt
Package fmt provides bindings for Go's fmt package.
|
Package fmt provides bindings for Go's fmt package. |
|
json
Package json provides bindings for Go's encoding/json package.
|
Package json provides bindings for Go's encoding/json package. |
|
net
Package http provides bindings for Go's net/http package.
|
Package http provides bindings for Go's net/http package. |
|
os
Package os provides bindings for Go's os package.
|
Package os provides bindings for Go's os package. |
|
sync
Package sync provides bindings for Go's sync package and concurrency primitives.
|
Package sync provides bindings for Go's sync package and concurrency primitives. |
|
Package polyfills provides Node.js-compatible globals for the Goja runtime.
|
Package polyfills provides Node.js-compatible globals for the Goja runtime. |
|
stdlib
|
|
|
memory
Package memory provides the typego:memory module for shared memory and stats.
|
Package memory provides the typego:memory module for shared memory and stats. |
|
worker
Package worker provides the typego:worker module for multi-threading.
|
Package worker provides the typego:worker module for multi-threading. |
Click to show internal directories.
Click to hide internal directories.