import type { AtomConfig, AtomType } from "./atom"; /** * Creates a throttled reactive atom — at most one `set()` or `update()` call * fires per `delay` ms window. Additional calls within the same window are * dropped; the first call in each window goes through immediately. * * Accepts either a plain initial value or a source {@link AtomType}. When a * source atom is provided the returned atom mirrors the source's value, but * propagation to subscribers is throttled so that downstream reactions fire at * most once per `delay` ms regardless of how frequently the source changes. * * Cleanup of the internal throttle timer is registered automatically via * `registerCleanup` — no manual teardown is required. * * @param initialAtomOrState - The initial value for the atom, or a source atom * whose value this atom should mirror with throttling applied. * @param delay - The minimum number of milliseconds that must elapse between * two consecutive `set()`/`update()` calls being forwarded to subscribers. * @param config - Optional {@link AtomConfig} forwarded to the underlying atom. * @returns A new {@link AtomType} whose `set` and `update` methods are * throttled by `delay` ms. * * @example * // Throttle direct writes — only one set fires per 100 ms window: * const scrollY = throttledAtom(0, 100); * window.addEventListener("scroll", () => scrollY.set(window.scrollY)); * // Only one set fires per 100ms no matter how fast the user scrolls * * @example * // Mirror a source atom with throttling applied: * const rawScroll = atom(0); * const throttled = throttledAtom(rawScroll, 100); * // throttled mirrors rawScroll but notifies its own subscribers at most * // once every 100 ms */ export declare const throttledAtom: (initialAtomOrState: T | AtomType, delay: number, config?: AtomConfig) => AtomType; //# sourceMappingURL=throttledAtom.d.ts.map