All Downloads are FREE. Search and download functionalities are using the official Maven repository.

package.dist.util.debounce.js Maven / Gradle / Ivy

/**
 * Delays function execution by given threshold.
 * @param fn {Function}
 * @param delay {Integer}
 */
let debounceInterval = null;
const debounce = (fn, delay) => {
    debounceInterval && clearTimeout(debounceInterval);
    debounceInterval = setTimeout(() => {
        debounceInterval = null;
        fn();
    }, delay);
};
export default debounce;
//# sourceMappingURL=debounce.js.map




© 2015 - 2024 Weber Informatics LLC | Privacy Policy