proxy-vir
Version:
An easier Proxy.
25 lines (24 loc) • 1.14 kB
TypeScript
import { type PartialWithUndefined } from '@augment-vir/common';
export type PriorityListInputs<EntryType> = {
initialList: ReadonlyArray<EntryType>;
overrideEntryPoint: number;
updateCallback?: (combined: EntryType) => void;
};
/**
* Stores and allows updating of a list of entries from which a single object is created. Properties
* for the single object are chosen from the entries by the entry order in the list.
*/
export declare function createPrioritizedProperties<EntryType>(options?: PartialWithUndefined<PriorityListInputs<EntryType>>): {
/**
* An object containing all properties combined from the current priority list of entries.
* This reference never changes, just its contents, so you are safe to grab and use this
* object directly.
*/
combinedProperties: EntryType;
addOverride(entry: Partial<EntryType>): void;
addFallback(entry: Partial<EntryType>): void;
/** Return value indicates if the given entry was removed or not. */
removeEntry(entry: Partial<EntryType>): boolean;
forceUpdate(): void;
getCurrentList(): ReadonlyArray<Partial<EntryType>>;
};