fluidstate
Version:
Library for fine-grained reactivity state management
32 lines (31 loc) • 1.45 kB
TypeScript
import { ContextReactiveOptions } from "./reactive-abstraction-types";
type Context = {
reactiveOptions?: ContextReactiveOptions;
};
export declare const simplePrototypeList: WeakSet<object>;
/**
* Registers a prototype object to be considered "simple".
*
* Objects whose prototype is in this list will be treated by `isSimpleObject`
* as candidates for deep reactivity by default. This allows custom classes or
* objects with specific prototypes to be automatically wrapped in reactive proxies
* when encountered within a larger reactive structure, assuming `deep` reactivity
* is enabled.
*
* @param simplePrototype The prototype object to register.
*/
export declare const addSimplePrototype: (simplePrototype: object) => void;
/**
* Unregisters a prototype object, so it's no longer considered "simple".
*
* This is the counterpart to `addSimplePrototype`. Objects whose prototype was
* previously registered will no longer be identified as "simple" by default
* by `isSimpleObject` after being removed.
*
* @param simplePrototype The prototype object to unregister.
*/
export declare const removeSimplePrototype: (simplePrototype: object) => void;
export declare const isSimpleObject: <T>(object: T) => object is T & object;
export declare const getChildOptions: (parentContext: Context) => ContextReactiveOptions;
export declare const getChild: <T>(context: Context, object: T, createProxy: () => T) => T;
export {};