wasm

command
v1.17.0 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

README

WebAssembly Development Package

This package provides SpiceDB's development functionality via a WebAssembly interface, for use with browser-based tooling.

Warning The WebAssembly development interface is, at this time, not stable and subject to change between versions of SpiceDB.

Generating WebAssembly

GOOS=js GOARCH=wasm go build -o main.wasm

Generating the types for use in TypeScript

To generate TypeScript for the internal development messages used as part of the interface, add to a buf.dev.gen.yaml in the root of the SpiceDB package and then run ./buf.dev.gen.yaml:

#!/usr/bin/env -S buf generate proto/internal/developer/v1/developer.proto --template
---
version: "v1"
plugins:
  - remote: buf.build/timostamm/plugins/protobuf-ts:v2.2.2-1
    out: "src/"
    opt:
      - long_type_string
      - generate_dependencies

Integrating with the browser

To see an example of invoking the WebAssembly based interface:

  1. Build main.wasm and copy into the example directory.
  2. Copy https://github.com/golang/go/blob/master/misc/wasm/wasm_exec.js into the example directory
  3. Run an HTTP server over the example directory and visit wasm.html:
python3 -m http.server

Documentation

Rendered for js/wasm
The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

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