Documentation

Overview

Package wasmgo contains hacks and bindings in order to "mixin" the Go webassembly ABI to another webassembly module.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ImplementedGoABIFuncs is not used at runtime. This is used for documentation only.
	ImplementedGoABIFuncs = []string{
		"debug",
		"runtime.wasmExit",
		"runtime.wasmWrite",
		"runtime.nanotime",
		"runtime.walltime",
		"runtime.scheduleTimeoutEvent",
		"runtime.clearTimeoutEvent",
		"runtime.getRandomData",
		"syscall/js.stringVal",
		"syscall/js.valueGet",
		"syscall/js.valueSet",
		"syscall/js.valueIndex",
		"syscall/js.valueSetIndex",
		"syscall/js.valueCall",
		"syscall/js.valueInvoke",
		"syscall/js.valueNew",
		"syscall/js.valueLength",
		"syscall/js.valuePrepareString",
		"syscall/js.valueLoadString",
		"syscall/js.valueInstanceOf",
	}
)
View Source
var Undefined = &struct{}{}

Undefined isn't defined, but we have to make it _something_.

Functions

This section is empty.

Types

type ArrayBuffer

type ArrayBuffer struct {
	Data []byte
}

ArrayBuffer is a wrapper around arrays for "JS" interop

type FuncWrapper

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

type Object

type Object struct {
	Props map[string]interface{}
	New   func(args []interface{}) interface{}
}

Object is a generic JS-like object.

type TypedArray

type TypedArray struct {
	Buffer *ArrayBuffer
	Offset int
	Length int
}

TypedArray is an ArrayBuffer with an offset and length

type WasmGo

type WasmGo struct {
	*cwa.Process

	BootTime   time.Time
	Exited     bool
	StatusCode int32
	Memory     *ArrayBuffer
	// contains filtered or unexported fields
}

func New

func New(name string, argv []string, env map[string]string) *WasmGo

func (*WasmGo) ResolveFunc

func (w *WasmGo) ResolveFunc(module, field string) exec.FunctionImport

func (*WasmGo) ResolveGlobal

func (w *WasmGo) ResolveGlobal(module, field string) int64

ResolveGlobal does nothing, currently.