1.0.0 ⢠Published 4 years ago
z-debouncer v1.0.0
Welcome to z-debouncer š
Simple JS debounce functionality
š Homepage
Install
npm install z-debouncer
Usage
const debouncer = require('z-debouncer');
let debounce = debouncer.create();
debounce.add(() => console.log('Hello World'));
debounce.add(() => console.log('Hello World 2'));
debounce.add(() => console.log('Hello World 3'));
// Hello World 3
Event Handling
<button id="someButton" onclick="buttonEvent()">Click Me</button>
let debounce = debouncer.create();
function buttonEvent() {
debounce.add(() => console.log('Only run once!'));
}
API
debouncer.create(delay)
Creates a new instance of Debouncer.
Parameter | Type | Description |
---|---|---|
delay | number | Millisecond delay for before running. Defaults to 1000 |
instance.add(func)
Add a function call to the debounce stack, replacing any existing calls.
Parameter | Type | Description |
---|---|---|
func | function | Function to run |
Author
š¤ zachnology
- Github: @zachnology
š¤ Contributing
Contributions, issues and feature requests are welcome!
Feel free to check issues page. You can also take a look at the contributing guide.
Show your support
Give a āļø if this project helped you!
š License
Copyright Ā© 2021 Zack Gomez.
This project is MIT licensed.
This README was generated with ā¤ļø by readme-md-generator
1.0.0
4 years ago
0.0.3-alpha
4 years ago