API reference

Every public class, method, and event in @codexo/exojs. Generated from source.

I

interfaceDatabase

@codexo/exojs / assets / stable

Low-level key/value database abstraction with a declared schema. Data is organised into named object stores (`type`) that act as namespaces, each holding entries keyed by `name`. The set of stores is fixed when the database is created, which makes this the backing for structured application data such as save games; the asset cache uses CacheStore, whose namespaces are data rather than schema. IndexedDbDatabase is the built-in implementation.

3
props
8
methods
0
events
Import
import { Database } from '@codexo/exojs'

Low-level key/value database abstraction with a declared schema.

Data is organised into named object stores (`type`) that act as namespaces, each holding entries keyed by `name`. The set of stores is fixed when the database is created, which makes this the backing for structured application data such as save games; the asset cache uses CacheStore, whose namespaces are data rather than schema. IndexedDbDatabase is the built-in implementation.

Methods8
clearStorage(type: string): Promise<boolean>
Removes all entries from the type object store without dropping the store itself. Resolves true on success.
connect(): Promise<boolean>
Opens the database connection, running any pending schema migrations. Resolves to true when the connection is ready; rejects on error. Calling this when already connected is a no-op that resolves true.
delete(type: string, name: string): Promise<boolean>
Deletes the entry with the given name from the type object store. Resolves true on success.
deleteStorage(): Promise<boolean>
Disconnects and then permanently deletes the entire database. Resolves true on success.
destroy(): void
Synchronously closes any open handles without waiting for pending transactions to complete. Prefer disconnect for graceful teardown.
disconnect(): Promise<boolean>
Closes the live database connection and resets the connected state. Always resolves true; safe to call when not connected.
load(type: string, name: string): Promise<T | null>
Retrieves the entry with the given name from the type object store, or null if no such entry exists.
save(type: string, name: string, data: unknown): Promise<void>
Persists data under name within the type object store, replacing any existing entry with the same name.
Properties3
connected: boolean
Whether a live connection to the underlying database is open.
name: string
Human-readable database identifier, typically an application name.
version: number
Schema version used during upgradeneeded migrations.
Source