Do you prefer JavaScript or TypeScript?
Are you coming from any of the following frameworks?

createDeferred

ts
function createDeferred<T>(
source: () => T,
options?: {
timeoutMs?: number;
equals?: false | ((prev: T, next: T) => boolean);
name?: string;
}
): () => T;
ts
function createDeferred<T>(
source: () => T,
options?: {
timeoutMs?: number;
equals?: false | ((prev: T, next: T) => boolean);
name?: string;
}
): () => T;

Creates a readonly that only notifies downstream changes when the browser is idle. timeoutMs is the maximum time to wait before forcing the update.

Options

NameTypeDescription
timeoutMsnumberThe maximum time to wait before forcing the update.
equalsfalse | ((prev: T, next: T) => boolean)A function that returns true if the value has changed.
namestringThe name of the readonly.