@sv-use/core
Version:
A collection of Svelte 5 utilities.
26 lines (25 loc) • 1.04 kB
TypeScript
import type { Getter } from '../__internal__/types.js';
type WheneverOptions = {
/**
* Whether to run the effect on mount or not.
* @default true
*/
runOnMount?: boolean;
};
/**
* Triggers a callback when the dependency is `true`.
* @param dep The dependency to watch.
* @param fn The callback to trigger when the dependency is `true`.
* @param options Additional options to customize the behavior.
* @see https://svelte-librarian.github.io/sv-use/docs/core/whenever
*/
export declare function whenever(dep: Getter<boolean>, fn: () => void, options?: WheneverOptions): void;
/**
* Triggers a callback when the dependencies are `true`.
* @param deps The dependencies to watch.
* @param fn The callback to trigger when the dependencies are `true`.
* @param options Additional options to customize the behavior.
* @see https://svelte-librarian.github.io/sv-use/docs/core/whenever
*/
export declare function whenever(deps: Array<Getter<boolean>>, fn: () => void, options?: WheneverOptions): void;
export {};