gowasm

package
v0.0.0-...-a048d37 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewResolver

func NewResolver() exec.Resolver

NewResolver returns exec.Resolver which resolvers symbols needed by go runtime

Types

type Decoder

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

Decoder decode Go types from wasm memory

func NewDecoder

func NewDecoder(mem []byte, offset uint32) *Decoder

NewDecoder instances a new Decoder from given memory and offset

func (*Decoder) Decode

func (r *Decoder) Decode(ref reflect.Value)

Decode decode go type from memory, ref must be a pointer type

func (*Decoder) Offset

func (r *Decoder) Offset() uint32

Offset returns total decoded memory length

type Encoder

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

Encoder encodes go type to wasm memory

func NewEncoder

func NewEncoder(mem []byte, offset uint32) *Encoder

NewEncoder instances a new Encoder

func (*Encoder) Encode

func (e *Encoder) Encode(v reflect.Value)

Encode encode go type to wasm memory

type Runtime

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

Runtime implements the runtime needed to run wasm code compiled by go toolchain

func RegisterRuntime

func RegisterRuntime(ctx exec.Context) *Runtime

RegisterRuntime 用于向exec.Context里面注册一个初始化好的js Runtime

func (*Runtime) ExitCode

func (rt *Runtime) ExitCode() int32

ExitCode return the exit code of go application

func (*Runtime) Exited

func (rt *Runtime) Exited() bool

Exited will be true if runtime.wasmExit has been called

func (*Runtime) WaitTimer

func (rt *Runtime) WaitTimer()

WaitTimer waiting for timeout of timers set by go runtime in wasm

Directories

Path Synopsis
js
fs

Jump to

Keyboard shortcuts

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