Skip to content

debounce

debounce<T>(func, wait): DebouncedFunction<T>

Defined in: utils/misc.ts:30

Debounce a function

Type Parameters

T extends (…args) => any

Parameters

func

T

function to debounce

wait

number

time in milliseconds

Returns

DebouncedFunction<T>

Examples

const debounced = debounce(() => console.log('debounced'), 1000);
window.addEventListener('resize', debounced);