wasm

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2022 License: MIT Imports: 15 Imported by: 0

README

go-wasm

A port of wasm_exec.js in Go. Run WASM built from Go.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bytes

func Bytes(v interface{}) ([]byte, error)

func Error

func Error(v interface{}) (errVal, err error)

func FromBytes

func FromBytes(v []byte) interface{}

func String

func String(v interface{}) (string, error)

Types

type Bridge

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

func BridgeFromBytes

func BridgeFromBytes(name string, bytes []byte, imports *wasmer.Imports) (*Bridge, error)

func BridgeFromFile

func BridgeFromFile(name, file string, imports *wasmer.Imports) (*Bridge, error)

func (*Bridge) CallFunc

func (b *Bridge) CallFunc(fn string, args []interface{}) (interface{}, error)

func (*Bridge) Run

func (b *Bridge) Run(ctx context.Context, init chan error)

Run start the wasm instance.

func (*Bridge) SetFunc

func (b *Bridge) SetFunc(fname string, fn Func) error

type Func

type Func func(args []interface{}) (interface{}, error)

TODO make this a wrapper that takes an inner `this` js object

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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