Delay is set to 1000ms for this demo.

Throttled:

Times Updated: 0

useThrottle

Throttle changing of a ref value.

Usage

import { useThrottle } from '@vueuse/core'

const input = ref('')
const throttled = useThrottle(input, 1000)
  • useThrottle
  • useThrottleFn
  • useDebounce
  • useDebounceFn

Type Declarations

/**
 * Throttle execution of a function. Especially useful for rate limiting
 * execution of handlers on events like resize and scroll.
 *
 * @param  delay  A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.
 */
export declare function useThrottle<T>(value: Ref<T>, delay?: number): Ref<T>

Source

SourceDemoDocs