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/watchImmediate.md
1---2category: Watch3---45# watchImmediate67Shorthand for watching value with `{immediate: true}`89## Usage1011Similar to `watch`, but with `{ immediate: true }`1213```ts14import { watchImmediate } from '@vueuse/core'1516const obj = ref('vue-use')1718// changing the value from some external store/composables19obj.value = 'VueUse'2021watchImmediate(obj, (updated) => {22console.log(updated) // Console.log will be logged twice23})24```2526## Type Declarations2728```ts29export declare function watchImmediate<T extends Readonly<MultiWatchSources>>(30source: [...T],31cb: WatchCallback<MapSources<T>, MapOldSources<T, true>>,32options?: Omit<WatchOptions<true>, "immediate">,33): WatchHandle34export declare function watchImmediate<T>(35source: WatchSource<T>,36cb: WatchCallback<T, T | undefined>,37options?: Omit<WatchOptions<true>, "immediate">,38): WatchHandle39export declare function watchImmediate<T extends object>(40source: T,41cb: WatchCallback<T, T | undefined>,42options?: Omit<WatchOptions<true>, "immediate">,43): WatchHandle44```45