vue-qs / QueryAdapter
Type Alias: QueryAdapter
QueryAdapter =
object
Defined in: adapters/types.ts:23
Connects vue-qs to a source of truth for the URL (browser History API, Vue Router, an in-memory store for tests…).
Example
const adapter = createAdapter({
getSearchParams: () => new URLSearchParams(location.search),
updateUrl: (search, { history }) => { ... },
subscribe: (onChange) => { ...; return () => {} },
})Properties
rateLimitFactor?
optionalrateLimitFactor?:number
Defined in: adapters/types.ts:38
Multiplier applied to throttle delays (0 disables throttling, e.g. in tests).
Methods
getSearchParams()
getSearchParams():
URLSearchParams
Defined in: adapters/types.ts:25
Returns the current search params. Callers must not mutate the result.
Returns
URLSearchParams
updateUrl()
updateUrl(
search,options):false|void|Promise<false|void>
Defined in: adapters/types.ts:31
Writes new search params to the URL. May return a promise for async navigation. Return (or resolve) false when the URL did not take the update, e.g. a cancelled or redirected navigation: composables then re-read the URL.
Parameters
search
URLSearchParams
options
Returns
false | void | Promise<false | void>
subscribe()
subscribe(
onChange): () =>void
Defined in: adapters/types.ts:36
Calls onChange when the URL changes from outside vue-qs. Returns an unsubscribe function.
Parameters
onChange
() => void
Returns
() => void