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/useThrottledRefHistory.md
1---2category: State3related: useDebouncedRefHistory, useRefHistory4---56# useThrottledRefHistory78Shorthand for `useRefHistory` with throttled filter.910## Usage1112This function takes the first snapshot right after the counter's value was changed and the second with a delay of 1000ms.1314```ts15import { useThrottledRefHistory } from '@vueuse/core'16import { shallowRef } from 'vue'1718const counter = shallowRef(0)19const { history, undo, redo } = useThrottledRefHistory(counter, { deep: true, throttle: 1000 })20```2122## Type Declarations2324```ts25export type UseThrottledRefHistoryOptions<Raw, Serialized = Raw> = Omit<26UseRefHistoryOptions<Raw, Serialized>,27"eventFilter"28> & {29throttle?: MaybeRef<number>30trailing?: boolean31}32export type UseThrottledRefHistoryReturn<33Raw,34Serialized = Raw,35> = UseRefHistoryReturn<Raw, Serialized>36/**37* Shorthand for [useRefHistory](https://vueuse.org/useRefHistory) with throttled filter.38*39* @see https://vueuse.org/useThrottledRefHistory40* @param source41* @param options42*/43export declare function useThrottledRefHistory<Raw, Serialized = Raw>(44source: Ref<Raw>,45options?: UseThrottledRefHistoryOptions<Raw, Serialized>,46): UseThrottledRefHistoryReturn<Raw, Serialized>47```48