Lightweight debounce function for node


stars 🌟issues ⚠️updated 🛠created 🐣size 🏋️‍♀️
12Sep 25, 2018Jul 28, 2018Minified + gzip package size for @nielse63/debounce in KB



Lightweight debounce function for node


Install with Yarn or npm

yarn add --dev @nielse63/debounce
npm install --save-dev @nielse63/debounce


const debounce = require('@nielse63/debounce');

const fn = () => {
  // some expensive function...

debounce(fn); // executed after 250ms


debounce(callback[, delay, immediate])

Name Type Description Default
callback Function Callback to execute after delay undefined
delay Number Delay, in ms, before executing callback 250
immediate Boolean Whether or not to run the function immediately false

Return Value

Function - The wrapper to execute the callback


Development Setup

This project uses a monorepo setup that requires using Yarn because it relies on Yarn workspaces. Clone the repo and install the dependencies:

git clone https://github.com/nielse63/nielse63.git
cd nielse63


MIT © Erik Nielsen

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.