1 | /**
|
2 | * Makes an object and its properties reactive recursively.
|
3 | * Subobjects (but not subfunctions!) will also be observed.
|
4 | * Note that `observe` does not create a new object, it mutates the object passed into it: `observe(object) === object`.
|
5 | * @param {Object} object Object or function to make reactive
|
6 | * @returns {Object} Input `object`, now reactive
|
7 | */
|
8 | export declare function observe<T extends object>(object: T): T;
|
9 |
|
10 | /**
|
11 | * Prevents an object from being made reactive, `observe` will do nothing.
|
12 | * Note that `ignore` is not recursive, so subobjects can still be made reactive by calling `observe` on them directly.
|
13 | * @param {Object} object Object or function to ignore
|
14 | * @returns {Object} Input `object`, now permanently ignored
|
15 | */
|
16 | export declare function ignore<T extends object>(object: T): T;
|
17 |
|
18 | /**
|
19 | * Calls `func` with no arguments and records a list of all the reactive properties it accesses.
|
20 | * `func` will then be called again whenever any of the accessed properties are mutated.
|
21 | * Note that if `func` has been `dispose`d with `!!clean === false`, no operation will be performed.
|
22 | * @param {Function} func Function to execute
|
23 | * @returns {Function} Input `func`
|
24 | */
|
25 | export declare function computed<T extends () => void>(func: T): T;
|
26 |
|
27 | /**
|
28 | * "Disposes" a function that was run with `computed`, deregistering it so that it will no longer be called whenever any of its accessed reactive properties update.
|
29 | * The <code>clean</code> parameter controls whether calling `computed` with `func` will work or no-op.
|
30 | * @param {Function} [func] Function to dispose, omit to dispose the currently executing computed function
|
31 | * @param {boolean} [clean] If truthy, only deregister the function from all dependencies, but allow it to be used with `computed` again in the future
|
32 | * @returns {Function} Input `func` if `func` is valid, otherwise `undefined`
|
33 | */
|
34 | export declare function dispose(func?: null, clean?: boolean | null): void;
|
35 | export declare function dispose<T extends () => void>(func: T, clean?: boolean | null): T;
|