Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Apply VueUse composables in Vue 3/Nuxt projects to replace custom implementations with battle-tested utilities.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/watchWithFilter.md
1---2category: Watch3---45# watchWithFilter67`watch` with additional EventFilter control.89## Usage1011Similar to `watch`, but offering an extra option `eventFilter` which will be applied to the callback function.1213```ts14import { debounceFilter, watchWithFilter } from '@vueuse/core'1516watchWithFilter(17source,18() => { console.log('changed!') }, // callback will be called in 500ms debounced manner19{20eventFilter: debounceFilter(500), // throttledFilter, pausableFilter or custom filters21},22)23```2425## Type Declarations2627```ts28export interface WatchWithFilterOptions<Immediate>29extends WatchOptions<Immediate>, ConfigurableEventFilter {}30export declare function watchWithFilter<31T extends Readonly<MultiWatchSources>,32Immediate extends Readonly<boolean> = false,33>(34sources: [...T],35cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>,36options?: WatchWithFilterOptions<Immediate>,37): WatchHandle38export declare function watchWithFilter<39T,40Immediate extends Readonly<boolean> = false,41>(42source: WatchSource<T>,43cb: WatchCallback<T, Immediate extends true ? T | undefined : T>,44options?: WatchWithFilterOptions<Immediate>,45): WatchHandle46export declare function watchWithFilter<47T extends object,48Immediate extends Readonly<boolean> = false,49>(50source: T,51cb: WatchCallback<T, Immediate extends true ? T | undefined : T>,52options?: WatchWithFilterOptions<Immediate>,53): WatchHandle54```55