コンテンツへスキップ

useThrottledRefHistory

カテゴリ
エクスポートサイズ
1.73 kB
最終更新日
先週
関連

スロットルフィルタを適用したuseRefHistoryの省略形。

デモ

カウント: 0
/
遅延 (ミリ秒)

履歴 (デモでは10件に制限)
2024-11-28 03:59:08{ value: 0 }

使用方法

この関数は、カウンターの値が変更された直後の最初のスナップショットと、1000ミリ秒の遅延を伴う2番目のスナップショットを取得します。

ts
import { useThrottledRefHistory } from '@vueuse/core'
import { ref } from 'vue'

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

型定義

typescript
export type UseThrottledRefHistoryOptions<Raw, Serialized = Raw> = Omit<
  UseRefHistoryOptions<Raw, Serialized>,
  "eventFilter"
> & {
  throttle?: MaybeRef<number>
  trailing?: boolean
}
export type UseThrottledRefHistoryReturn<
  Raw,
  Serialized = Raw,
> = UseRefHistoryReturn<Raw, Serialized>
/**
 * Shorthand for [useRefHistory](https://vueuse.dokyumento.jp/useRefHistory) with throttled filter.
 *
 * @see https://vueuse.dokyumento.jp/useThrottledRefHistory
 * @param source
 * @param options
 */
export declare function useThrottledRefHistory<Raw, Serialized = Raw>(
  source: Ref<Raw>,
  options?: UseThrottledRefHistoryOptions<Raw, Serialized>,
): UseThrottledRefHistoryReturn<Raw, Serialized>

ソースコード

ソースコードデモドキュメント

コントリビューター

Anthony Fu
Roman Harmyder
Anthony Fu
Jelf
Bodo Graumann
wheat

変更ログ

v12.0.0-beta.1 2024/11/21
0a9ed - feat!: Vue 2サポートの削除、バンドルの最適化、クリーンアップ (#4349)
v10.7.0 2023/12/5
fccf2 - feat: 依存関係のアップグレード (#3614)

MITライセンスの下でリリースされています。