DbMethods
Import
import { DbMethods } from "@hyper-fetch/db"
Source
Package
Preview
type DbMethods = {
clear: () => Promise<void>;
dehydrate: () => DehydratedDb;
destroy: () => void;
inspect: () => DbInspection;
onChange: (listener: () => void) => () => void;
onError: (listener: (event: DbErrorEvent) => void) => () => void;
ready: Promise<void>;
}
Structure
DbMethods
| Name | Type | Description |
|---|---|---|
| ready | | Resolves once persisted rows and the outbox are restored |
| clear | | Removes every row, loaded subset and pending write, and the persisted data of the scope, for example on sign-out |
| dehydrate | | The server rows and loaded subsets, as type-tagged JSON, for server rendering. Optimistic layers, the outbox and
syncs are never included. Pass it to
|
| destroy | | Stops every sync, timer and tab channel |
| inspect | | What the db holds right now: collections with their layers and subsets, live queries and the outbox |
| onChange | | Listens to every change the db makes, once per batch of writes, load or outbox change |
| onError | | Listens to failed writes, rejected validation, outbox and persistence errors |
