Skip to content

Latest commit

 

History

History
28 lines (20 loc) · 525 Bytes

functions.readme.md

File metadata and controls

28 lines (20 loc) · 525 Bytes

Commonly Typescript

Go back

Functions module

commonly.typescript/functions


  • debounce

Creates a debounced version of the function argument callback.

function debounce<Args extends any[]>(callback: (...args: Args) => void, delay = 500): (...args: Args) => void;

Usage:

const debounced = debounce((str: string) => console.log(str), 1000);
debounced('one');
debounced('two');
debounced('three');
// prints `three` after 1 second