wasm

command
v0.0.0-...-6e42c0c Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

README

Serverless WASM

This directory contains a version of the serverless tooling cross-compiled to WebAssembly (WASM).

This is an entirely experimental thing, mostly intended to explore the possibility of creating a semi "live" demo/toy to explore the concepts of transparent logging and the related ecosystem functions from within a browser environment.

Instructions

To build and run up a webserver which serves the WASM+support files, run the following commands from the root of this repo:

GOOS=js GOARCH=wasm go build -o ./serverless/experimental/wasm/main.wasm -tags wasm ./serverless/experimental/wasm/

then copy over the Go WASM shim into this directory:

cp "$(go env GOROOT)/misc/wasm/wasm_exec.js" serverless/experimental/wasm/

Run up a webserver to serve the files (use something which can infer the correct ContentType header to send). You can use goexec for this (install goexec with go get -u github.com/shurcooL/goexec):

goexec "http.ListenAndServe(`:8080`, http.FileServer(http.Dir(`serverless/experimental/wasm`)))"

Finally, point your browser at http://localhost:8080

Documentation

Rendered for js/wasm

Overview

Package main provides a series of entrypoints for using a serverless log from JavaScript in a browser.

See the accompanying README for details on how to spin this up in a browser.

Jump to

Keyboard shortcuts

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