Core · interface
SaveBackend
The asynchronous side, which the consumer implements.
Explained in The loop.
interface SaveBackendimport type { SaveBackend } from '@driftengine/core';In depth
save takes a batch rather than one key, because a network backend wants one round trip for
a screen's worth of changes and a per-key interface makes that impossible to build on top. A
consumer whose API is per-key loops inside save; a consumer whose API is a document writes one
request. The reverse adaptation cannot be done at all.
Methods
load
load(): Promise<Iterable<readonly [string, string]>>Everything this backend holds, read once before the first frame.
save
save(changes: ReadonlyMap<string, string | null>): Promise<void>Apply a batch. A null value is a removal, so one call carries both kinds of change.
| Parameter | Type | Description |
|---|---|---|
changes | ReadonlyMap<string, string | null> |
More
Reject to have the batch retried. Resolving is a promise that it landed: a backend that resolves optimistically turns this store's status into a decoration.