/** * A short list of what this browser reached for, newest first. * * Two surfaces on one application ask for the same list — a finder and a * picker, a search field and a recent-documents menu — and it is one list. A * person who typed an address into one and then opened the other has reached * for it once, not once per dialog, and two stores answer that differently * depending on which was opened first. So the store is a value a caller makes * once and hands to both. * * What is kept is where to look and nothing else. A name or a ticker kept * beside a key is a catalogue nobody refreshes: the venue renames the thing and * the remembered row goes on saying what it used to be called. Keys are * remembered; identity is read again each time, from whatever answered. * * Nothing here is a cache. A caller that cannot read the subject of a * remembered row draws no row, which is why the shape it stores should be the * smallest one a lookup needs. */ /** What a store answers. Three questions, because there are three. */ export interface Recall { /** What is remembered, or nothing. */ read(): T[]; /** The same list with one entry at its head, kept if the browser will keep * it. The list is passed in rather than read back, so a store that refuses * costs this visit's memory and nothing further. */ keep(had: readonly T[], one: T): T[]; /** Nothing remembered, here and in the store. Somebody clearing this is * asking for it to be gone rather than hidden. */ forget(): T[]; } export declare function recall(of: { /** * Where these are kept. Namespaced by the application, because an origin's * storage is shared with everything else it serves. */ key: string; /** How many to hold. How many of them a surface draws is that surface's own * measure. */ most?: number; /** * Whether a stored entry is one this build can still use. * * Storage outlives the code that wrote it, so every field is checked rather * than trusted — what happens next to one of these is a lookup against a * reading of a venue, and a half-written entry sends a malformed key. */ whole: (held: unknown) => held is T; /** Two entries being the same entry. */ same: (a: T, b: T) => boolean; }): Recall; //# sourceMappingURL=recall.d.ts.map