package
1.1.0
Repository: https://github.com/ejcx/wazero.git
Documentation: pkg.go.dev

# README

Overview

When GOOS=js and GOARCH=wasm, Go's compiler targets WebAssembly Binary format (%.wasm).

Wazero's "github.com/tetratelabs/wazero/experimental/gojs" package allows you to run a %.wasm file compiled by Go. This is similar to what is implemented in wasm_exec.js. See https://wazero.io/languages/go/ for more.

Example

wazero includes an example that makes HTTP client requests.

Experimental

Go defines js "EXPERIMENTAL... exempt from the Go compatibility promise." Accordingly, wazero cannot guarantee this will work from release to release, or that usage will be relatively free of bugs. Moreover, GOOS=wasip1 will be shipped in Go 1.21, and once that's available in two releases wazero will remove this package.

Due to these concerns and the relatively high implementation overhead, most will choose TinyGo instead of gojs.

# Packages

No description provided by the author

# Functions

Instantiate instantiates the "go" module, used by `GOARCH=wasm GOOS=js`, into the runtime.
MustInstantiate calls Instantiate or panics on error.
NewConfig returns a Config that can be used for configuring module instantiation.
NewFunctionExporter returns a FunctionExporter object.
Run instantiates a new module and calls "run" with the given config.

# Interfaces

Config extends wazero.ModuleConfig with GOOS=js specific extensions.
FunctionExporter configures the functions in the "go" module used by `GOARCH=wasm GOOS=js`.