Skip to main content

Overview

The API includes two common utility functions for controlling execution frequency.

api.debounce(fn, delay?)

Returns a debounced version of fn. The function only executes after delay milliseconds of inactivity.

Signature

Returns: function — debounced wrapper

api.throttle(fn, limit?)

Returns a throttled version of fn. The function executes at most once every limit milliseconds.

Signature

Returns: function — throttled wrapper

Debounce vs Throttle

Examples

Resize handling

Input filtering