API reference

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

C

classIndexedDbDatabase

@codexo/exojs / resources / stable

Database implementation backed by the browser's IndexedDB API. Each object store is created with a `keyPath` of `"name"`, so records are stored as `{ name, data }` objects. By default the database is initialised with stores for every built-in asset type (font, image, sound, etc.); pass a custom `storeNames` list to restrict or extend the set. Schema migrations are handled in two modes: - **Default** — the constructor-supplied `storeNames` list is diff'd against the existing stores and objects stores added/deleted accordingly. - **Explicit** — a `migrations` map keyed by target version runs the corresponding callback for each version between `oldVersion` and `newVersion`, allowing precise schema evolution.

3
props
9
methods
0
events
Import
import { IndexedDbDatabase } from '@codexo/exojs'

Database implementation backed by the browser's IndexedDB API.

Each object store is created with a `keyPath` of `"name"`, so records are stored as `{ name, data }` objects. By default the database is initialised with stores for every built-in asset type (font, image, sound, etc.); pass a custom `storeNames` list to restrict or extend the set.

Schema migrations are handled in two modes: - **Default** — the constructor-supplied `storeNames` list is diff'd against the existing stores and objects stores added/deleted accordingly. - **Explicit** — a `migrations` map keyed by target version runs the corresponding callback for each version between `oldVersion` and `newVersion`, allowing precise schema evolution.

Constructors 1
new(name: string, version: number, storeNames: readonly string[], migrations?: Record<number, object>): IndexedDbDatabase
Methods 9
clearStorage(type: string): Promise<boolean>
connect(): Promise<boolean>
delete(type: string, name: string): Promise<boolean>
deleteStorage(): Promise<boolean>
destroy(): void
disconnect(): Promise<boolean>
getObjectStore(type: string, transactionMode: IDBTransactionMode): Promise<IDBObjectStore>
load(type: string, name: string): Promise<T | null>
save(type: string, name: string, data: unknown): Promise<void>
Properties 3
name: string
version: number
connected: boolean
Source