/** * Effect - Run side effects reactively. */ /** * Create a reactive effect that automatically tracks dependencies * and re-runs when they change. * * The effect function can optionally return a cleanup function that will be * called before the effect re-runs and when the effect is disposed. * * @param fn - The effect function to run. May return a cleanup function. * @returns A dispose function to stop the effect * * @example * const count = signal(0); * const dispose = effect(() => { * console.log("Count is:", count.value); * }); * * count.value = 1; // logs: "Count is: 1" * dispose(); // stop the effect * * @example * // With cleanup function * const userId = signal(1); * const dispose = effect(() => { * const subscription = api.subscribe(userId.value); * return () => subscription.unsubscribe(); // cleanup * }); * * userId.value = 2; // cleanup runs, then effect re-runs with new subscription * dispose(); // final cleanup runs */ export declare function effect(fn: () => void | (() => void)): () => void; //# sourceMappingURL=effect.d.ts.map