New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

funkz-debounce

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

funkz-debounce

A debounce function delays the execution of a given function until after a specified time has passed since the last time it was called — helping to limit how often the function runs, especially during rapid events like typing or scrolling.

latest
Source
npmnpm
Version
1.0.1
Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

funkz-debounce

A lightweight and strongly typed debounce utility written in TypeScript.
It helps control how often a function is executed by delaying its execution until a specified amount of time has passed since the last call.

Installation

npm i funkz-debounce

Usage

import debounce from "funkz-debounce";

function handleInput(value: string) {
  console.log("Search:", value);
}

// Create a debounced version of the function
const debouncedSearch = debounce(handleInput, 500);

// Call multiple times, but it only triggers once after 500ms
debouncedSearch("apple");
debouncedSearch("banana");
debouncedSearch("orange");

Function Signature

debounce<T extends (...args: Array<unknown>) => void>(
    func: T,
    delay: number,
    immediate: boolean = false
): (...args: Parameters<T>) => void;

Parameters:

  • func : The function to debounce.
  • delay : The time (in milliseconds) to wait before executing.
  • immediate : If true, run the function immediately on the first call, then ignore subsequent calls until the delay passes.

Example with Immediate Execution

const logClick = debounce(() => console.log("Clicked!"), 300, true);

document.addEventListener("click", logClick);

In this case, the function executes immediately on the first click, then ignores any other clicks for the next 300ms.

License

MIT © 2025 Ariel Francis Fernando Gacilo

Keywords

debounce

FAQs

Package last updated on 22 Oct 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts