Skip to content

debounce

Create a debounce function that delays the execution of the fn method by delay milliseconds after the last call.

Usage

ts
import { debounce } from 'rattail'

const debouncedFn = debounce(() => {
  // do something
}, 1000)

window.addEventListener('resize', debouncedFn)

Arguments

ArgTypeDefaults
fnFunction
delaynumber0

Return

Type
Function