1.0.0 • Published 4 years ago

z-debouncer v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

Welcome to z-debouncer šŸ“

Version Maintenance License: MIT

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.

ParameterTypeDescription
delaynumberMillisecond delay for before running. Defaults to 1000

instance.add(func)

Add a function call to the debounce stack, replacing any existing calls.

ParameterTypeDescription
funcfunctionFunction to run

Author

šŸ‘¤ 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