dm

package
v0.3.18 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2024 License: BSD-2-Clause Imports: 7 Imported by: 0

Documentation

Rendered for js/wasm

Index

Constants

View Source
const (
	NewStateTag worker.Tag = "NewState"
	SetTag      worker.Tag = "Set"
	GetTag      worker.Tag = "Get"
)

List of tags that can be used when sending a message or registering a handler to receive a message.

Variables

This section is empty.

Functions

func NewState

func NewState(path, wasmJsPath string) (impl.WebState, error)

NewState returns a [utility.WebState] backed by indexeddb. The name should be a base64 encoding of the users public key.

Types

type NewStateMessage

type NewStateMessage struct {
	DatabaseName string `json:"databaseName"`
}

NewStateMessage is JSON marshalled and sent to the worker for NewState.

type TransferMessage

type TransferMessage struct {
	Key   string `json:"key"`
	Value []byte `json:"value"`
	Error string `json:"error"`
}

TransferMessage is JSON marshalled and sent to the worker.

type WebState

type WebState interface {
	Get(key string) ([]byte, error)
	Set(key string, value []byte) error
}

WebState defines an interface for setting persistent state in a KV format specifically for web-based implementations.

Jump to

Keyboard shortcuts

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