UNPKG

fluidstate

Version:

Library for fine-grained reactivity state management

75 lines (74 loc) 4.02 kB
import { ComputedOptions, ReactionOptions, ReactiveValueOptions } from "./reactive-primitive-types"; /** * A special symbol used to indicate that a reactive value has changed, * bypassing the standard equality check. This is useful in scenarios where * the content of the reactive values is not needed, but a change notification * is still desired. Assigning `CHANGED` as the content of the reactive value * will always result in change propagation. This, however, only applies * to the default equality check. If the equality check is overwritten, * `CHANGED` may need to be accounted for in the custom equality check */ export declare const CHANGED: unique symbol; export declare const reactiveValueEquals: (oldValue: unknown, newValue: unknown) => boolean; export declare const defaultEquals: (oldValue: unknown, newValue: unknown) => boolean; export declare const defaultReactiveValueOptions: ReactiveValueOptions; /** * Retrieves a copy of the default options used for reactive values. * This ensures that modifications to the returned options object do not affect * the global default settings. * * @returns A new object containing the current default `ReactiveValueOptions`. */ export declare const getDefaultReactiveValueOptions: () => ReactiveValueOptions; /** * Configures the global default options for reactive values. * These defaults will be used by newly created reactive values unless overridden * by options provided at creation time. * * @param newOptions - An object containing partial `ReactiveValueOptions` to update. * Only the specified properties will be updated; unspecified properties will retain * their current default values. If a property is set to `undefined`, it will revert * to its original default (e.g., `defaultEquals` for `equals`). */ export declare const configureDefaultReactiveValueOptions: (newOptions: Partial<ReactiveValueOptions>) => void; export declare const defaultComputedOptions: ComputedOptions; /** * Retrieves a copy of the default options used for computed atoms. * This ensures that modifications to the returned options object do not affect * the global default settings. * * @returns A new object containing the current default `ComputedOptions`. */ export declare const getDefaultComputedOptions: () => ComputedOptions; /** * Configures the global default options for computed atoms. * These defaults will be used by newly created computed atoms unless overridden * by options provided at creation time. * * @param newOptions - An object containing partial `ComputedOptions` to update. * Only the specified properties will be updated; unspecified properties will retain * their current default values. If a property is set to `undefined`, it will revert * to its original default (e.g., `defaultEquals` for `equals`). */ export declare const configureDefaultComputedOptions: (newOptions: Partial<ComputedOptions>) => void; export declare const defaultReactionScheduler: (fn: () => void) => void; export declare const defaultReactionOptions: ReactionOptions; /** * Retrieves a copy of the default options used for reactions. * This ensures that modifications to the returned options object do not affect * the global default settings. * * @returns A new object containing the current default `ReactionOptions`. */ export declare const getDefaultReactionOptions: () => ReactionOptions; /** * Configures the global default options for reactions. * These defaults will be used by newly created reactions unless overridden * by options provided at creation time. * * @param newOptions - An object containing partial `ReactionOptions` to update. * Only the specified properties will be updated; unspecified properties will retain * their current default values. If a property is set to `undefined`, it will revert * to its original default (e.g., `defaultReactionScheduler` for `scheduler`). */ export declare const configureDefaultReactionOptions: (newOptions: Partial<ReactionOptions>) => void;