Skip to content

Store beta ​

Interface of @v12-engine/client

ts
export interface Store<R extends {
    id: string;
} = {
    id: string;
}>

Records of plain data with an id, kept where a game says: list, read, write and remove, all asynchronous

Members ​

heads ​

ts
heads?(): Promise<Partial<R>[]>;

Every record without its heavy field (the world of a save), for a list that shows what is about them: left out by a store that has no cheaper way than list, which the caller then strips itself. indexedStore keeps the records without the field beside the whole ones, so a list reads no world

id ​

ts
id: string;

list ​

ts
list(): Promise<R[]>;

Every record kept, in no particular order

read ​

ts
read(id: string): Promise<R | undefined>;

The record of an id, or undefined when there is none

remove ​

ts
remove(id: string): Promise<void>;

Forgets the record of an id; nothing when there is none

write ​

ts
write(record: R): Promise<void>;

Keeps a record, replacing the one of its id