wasmexec

package module
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2023 License: BSD-3-Clause Imports: 2 Imported by: 5

README

wasmexec

For applications that need to provide the correct wasm_exec.js based on a go runtime version.

Rationale

The $GOROOT/misc/wasm/wasm_exec.js file is included in the go installation, but is only accessible from the filesystem.

This module provides a means to source the correct wasm_exec.js content programmatically.

Example


http.HandleFunc("/wasm_exec.js", func(writer http.ResponseWriter, request *http.Request) {
    content, err := wasmexec.Current()
    if err != nil {
    writer.WriteHeader(http.StatusInternalServerError)
        return
    }
    writer.Header().Set("Content-Type", "application/javascript")
    _, _ = writer.Write(content)
})

Go Report Card

created by tigwen

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Current

func Current() (content []byte, err error)

func Version

func Version(version string) (content []byte, err error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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