useDebouncedRefHistory

useDebouncedRefHistory

useRefHistory にデバウンスフィルターを適用したショートハンド。

使用方法

この関数は、値が変化し始めてから1000ms後にカウンターのスナップショットを取得します。

import { useDebouncedRefHistory } from '@vueuse/core'
import { shallowRef } from 'vue'

const counter = shallowRef(0)
const { history, undo, redo } = useDebouncedRefHistory(counter, { deep: true, debounce: 1000 })