useThrottledRefHistory

useThrottledRefHistory

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

使用法

この関数は、カウンターの値が変更された直後に最初のスナップショットを取り、1000ms の遅延で2番目のスナップショットを取ります。

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

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