---
title: "debounce"
description: "Create a debounced function that delays invoking the callback until the wait time elapses since the last call, ideal for input and resize handlers."
canonical_url: "https://core.mhaibaraai.cn/en/docs/utilities/async/debounce"
---
# debounce

> Create a debounced function that delays invoking the callback until the wait time elapses since the last call, ideal for input and resize handlers.

## Usage

`debounce` wraps a function so that it is only invoked after the specified wait time has elapsed since the last call.

```ts
import { debounce } from '@movk/core'

const debouncedSearch = debounce((query: string) => {
  console.log('Search:', query)
}, 300)

// Rapid calls — only the last one executes
debouncedSearch('a')
debouncedSearch('ab')
debouncedSearch('abc') // Only this call runs, after 300ms
```

## API

### `debounce<T>(func, wait)`

Create a debounced function that delays invocation until the wait time elapses since the last call.

### Parameters

**func** (`T extends (...args: any[]) => any`) *required*: The function to debounce.

**wait** (`number`) *required*: The debounce delay in milliseconds.

### Returns

**returns** (`(...args: Parameters<T>) => void`): The debounced function.

## Changelog

See commit history for [src/utilities/async/debounce.ts](https://github.com/mhaibaraai/movk-core/commits/main/src/utilities/async/debounce.ts).

---

- [GitHub](https://github.com/mhaibaraai/movk-core/blob/main/src/utilities/async/debounce.ts)


## Sitemap

See the full [sitemap](https://core.mhaibaraai.cn/sitemap.md) for all pages.
