This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as React from "react"; | |
type Timer = ReturnType<typeof setTimeout>; | |
type SomeFunction = (...args: any[]) => void; | |
/** | |
* Debounces a function call with the specified delay. | |
* | |
* @param func The original, non debounced function (You can pass any number of args to it). | |
* @param delay The delay (in ms) for the function to return. | |
* @returns The debounced function, which will run only if the debounced function has not been called in the last (delay) ms. |