UNPKG

957 BTypeScriptView Raw
1/**
2 * Makes a JavaScript object reactive
3 * @param {Object} obj Object to observe
4 * @returns {Object} Original input `obj`, now with reactivity
5 */
6export declare function observe<T extends object>(obj: T): T;
7
8/**
9 * Executes a function as a computed task and record its dependencies. The task
10 * will then be re-run whenever its dependencies change
11 * @param {Function} task Function to run and register as a computed task
12 * @return {Function} Original input `task`, now registered as a computed task
13 */
14export declare function computed<T extends () => void>(task: T): T;
15
16/**
17 * Marks a function as "disposed" which will prevent it from being run as a
18 * computed task and remove it from the dependencies of reactive objects
19 * @param {Function} [task] Computed task function to dispose of, omit this
20 * parameter to dispose of the current computed task
21 */
22export declare function dispose(task?: (() => void) | null): void;