export { hashValue, registerCustomHash } from './internals/utils/hash.js'; export { snapshot, registerCustomSnapshot } from './internals/utils/snapshot.js'; import { RelayState, ReactivePromise } from './types.js'; /** * Watches a function once in a reactive context, activating any relays, * then automatically tears down the watcher when complete. * * This is useful for testing or one-time reactive operations where you need * relays to be active but don't want the watcher to reschedule on updates. * * @param fn - A sync or async function to watch once * @returns A promise that resolves with the function's return value * * @example * ```ts * await watchOnce(async () => { * const data = relay((state) => { * // relay will be activated during watchOnce * fetch('/api/data').then(res => state.value = res.data); * }); * await data; * return data.value; * }); * ``` */ export declare function watchOnce(fn: () => T): T; export { setReactivePromise } from './internals/async.js'; /** * Forwards state from a source relay to the target relay's state. * This enables composition patterns where relays can add side effects * while transparently forwarding state from another relay. * * The forwarding is automatically tracked through the signal graph. * When the source relay updates, the target relay will re-run its * activation function, and forwardRelay will forward the new state. * No cleanup is needed - dependencies are managed automatically. * * @param state - The target relay's state object * @param sourceRelay - The source relay to forward state from * * @example * ```ts * const sourceRelay = relay(state => { * // ... source relay logic * }); * * const forwardedRelay = relay(state => { * // Add additional side effect * const cleanup = setupSomeEffect(); * * // Forward state from source relay (automatically tracked and cleaned up) * forwardRelay(state, sourceRelay); * * return cleanup; // Only return cleanup for the additional effect * }); * ``` */ export declare function forwardRelay(state: RelayState, sourceRelay: ReactivePromise): void; //# sourceMappingURL=utils.d.ts.map