UNPKG

nuqs-svelte

Version:

Svelte adaptation of the `nuqs` library for managing URL query strings as state.

19 lines (18 loc) 1.15 kB
import type { AdapterInterface } from "./adapters/types"; import type { Options } from "./types"; export declare const FLUSH_RATE_LIMIT_MS: number; export declare function getQueuedValue(key: string): string | null | undefined; export declare function resetQueue(): void; export declare function enqueueQueryStringUpdate<Value>(key: string, value: Value | null, serialize: (value: Value) => string, options: Pick<Options, "history" | "scroll" | "shallow" | "throttleMs">): string | null; /** * Eventually flush the update queue to the URL query string. * * This takes care of throttling to avoid hitting browsers limits * on calls to the history pushState/replaceState APIs, and defers * the call so that individual query state updates can be batched * when running in the same event loop tick. * * @returns a Promise to the URLSearchParams that have been applied. */ export declare function scheduleFlushToURL({ getSearchParamsSnapshot, updateUrl, rateLimitFactor, }: Pick<AdapterInterface, "updateUrl" | "getSearchParamsSnapshot" | "rateLimitFactor">): Promise<URLSearchParams>; export declare function compose(final: () => void): void;