UNPKG

svelte-ux

Version:

- Increment version in `package.json` and commit as `Version bump to x.y.z` - `npm run publish`

27 lines (26 loc) 1.23 kB
import type { Readable } from 'svelte/store'; import type { Page } from '@sveltejs/kit'; export type ParamType = 'string' | 'string[]' | 'number' | 'number[]' | 'boolean' | 'date' | 'datetime' | 'json' | 'object'; /** * Set a single querystring param * @param name * @param defaultValue * @returns */ export declare function queryParamStore<Value>(name: string, page: Readable<Page>, defaultValue?: Value, paramType?: ParamType): { subscribe: (this: void, run: import("svelte/store").Subscriber<any>, invalidate?: (value?: any) => void) => import("svelte/store").Unsubscriber; apply: (params: URLSearchParams, newValue: Value) => void; }; /** * Set all query string params based on object. Each object property represents a single query param * @param defaultValues * @returns */ export declare function queryParamsStore<Values extends { [key: string]: any; }>(page: Readable<Page>, defaultValues?: Values, paramTypes?: { [key: string]: ParamType; } | ((key: keyof Values) => ParamType)): { subscribe: (this: void, run: import("svelte/store").Subscriber<Values>, invalidate?: (value?: Values) => void) => import("svelte/store").Unsubscriber; create: (newValues: Values) => URLSearchParams; };