---
title: "throttle"
description: "Create a throttled function that runs at most once per interval, limiting how often expensive handlers fire during rapid events."
canonical_url: "https://core.mhaibaraai.cn/en/docs/utilities/async/throttle"
---
# throttle

> Create a throttled function that runs at most once per interval, limiting how often expensive handlers fire during rapid events.

## Usage

`throttle` wraps a function so that it executes at most once within the specified time interval.

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

const throttledScroll = throttle((event: Event) => {
  console.log('Scroll event handled')
}, 100)

// Listen to scroll events, executing at most once every 100ms
window.addEventListener('scroll', throttledScroll)
```

## API

### `throttle<T>(func, limit)`

Create a throttled function that runs at most once per interval.

### Parameters

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

**limit** (`number`) *required*: The throttle interval in milliseconds.

### Returns

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

## Changelog

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

---

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


## Sitemap

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