Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback


The Deno Standard Library
Go to Latest
function debounce
import { debounce } from "";

Creates a debounced function that delays the given func by a given wait time in milliseconds. If the method is called again before the timeout expires, the previous call will be aborted.


Example 1

import { debounce } from "";

await Array.fromAsync(
  debounce((event) => {
    console.log('[%s] %s', event.kind, event.paths[0]);
  }, 200),
// wait 200ms ...
// output: Function debounced after 200ms with baz

Type Parameters

T extends Array<any>


fn: (this: DebouncedFunction<T>, ...args: T) => void

The function to debounce.

wait: number

The time in milliseconds to delay the function.