wasm

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2026 License: MPL-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package wasm provides helpers for browser WASM island exports.

Index

Constants

This section is empty.

Variables

View Source
var ErrUnavailable = errors.New("gowdk wasm helpers are only available in js/wasm")

ErrUnavailable reports that the helper was called outside a js/wasm build.

Functions

func DecodePayload

func DecodePayload(target any) error

DecodePayload reports ErrUnavailable outside browser WASM builds.

func Return

func Return(value any) uint32

Return returns zero outside browser WASM builds.

func ReturnPatches

func ReturnPatches(patches any) uint32

ReturnPatches returns zero outside browser WASM builds.

func ReturnResult

func ReturnResult(result Result) uint32

ReturnResult returns zero outside browser WASM builds.

Types

type Payload

type Payload struct {
	ABIVersion  string            `json:"abiVersion,omitempty"`
	Component   string            `json:"component,omitempty"`
	Event       string            `json:"event,omitempty"`
	Binding     string            `json:"binding,omitempty"`
	Traceparent string            `json:"traceparent,omitempty"`
	Detail      map[string]any    `json:"detail,omitempty"`
	State       map[string]any    `json:"state,omitempty"`
	Stores      []string          `json:"stores,omitempty"`
	Props       map[string]any    `json:"props,omitempty"`
	Emits       map[string]any    `json:"emits,omitempty"`
	Refs        map[string]string `json:"refs,omitempty"`
	Bindings    map[string]any    `json:"bindings,omitempty"`
}

Payload is the JSON payload made available to a WASM island export.

func CurrentPayload

func CurrentPayload() (Payload, error)

CurrentPayload reports ErrUnavailable outside browser WASM builds.

type Result

type Result struct {
	Patches any            `json:"patches,omitempty"`
	Stores  map[string]any `json:"stores,omitempty"`
}

Result is the JSON result shape consumed by the WASM island loader.

Jump to

Keyboard shortcuts

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