Category | Watch |
---|---|
Export Size | 107 B |
Last Changed | 7 months ago |
watch
that only triggers once.
After the callback function has been triggered once, the watch will be stopped automatically.
import { watchOnce } from '@vueuse/core' watchOnce(source, () => { // triggers only once console.log('source changed!') })
export declare function watchOnce< T extends Readonly<WatchSource<unknown>[]>, Immediate extends Readonly<boolean> = false >( source: [...T], cb: WatchCallback<MapSources<T>, MapOldSources<T, Immediate>>, options?: WatchOptions<Immediate> ): void export declare function watchOnce< T, Immediate extends Readonly<boolean> = false >( sources: WatchSource<T>, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchOptions<Immediate> ): void
© 2019-present Anthony Fu
Licensed under the MIT License.
https://vueuse.org/shared/watchOnce/