wasmdb

command
v0.49.2 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2026 License: Unlicense Imports: 4 Imported by: 0

Documentation

Rendered for js/wasm

Overview

Package main provides the WASM entry point for the WasmDB database. It initializes the IndexedDB-backed Nostr event store and exposes the database API to JavaScript via the global `wasmdb` object.

Build with:

GOOS=js GOARCH=wasm go build -o wasmdb.wasm ./cmd/wasmdb

Usage in JavaScript:

// Load wasm_exec.js first (Go WASM runtime)
const go = new Go();
const result = await WebAssembly.instantiateStreaming(fetch('wasmdb.wasm'), go.importObject);
go.run(result.instance);

// Wait for ready
while (!wasmdb.isReady()) {
  await new Promise(resolve => setTimeout(resolve, 100));
}

// Use the API
await wasmdb.saveEvent(JSON.stringify(event));
const events = await wasmdb.queryEvents(JSON.stringify({kinds: [1], limit: 10}));

Source Files

  • main.go

Jump to

Keyboard shortcuts

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