0.0.3 • Published 9 months ago

any-debounce v0.0.3

Weekly downloads
-
License
MIT
Repository
-
Last release
9 months ago

Any Debounce

A simple debounce package made for any javascript project.

No dependencies.

Installation

npm i any-debounce

Usage

You can use the debouncer function to debounce a function and the useDebounce function to debounce a value.

Debouncing a value

Great for input fields using react and useState.

import { useDebounce } from "any-debounce";
import { useState } from "react";

const [value, setValue] = useState("");
const debouncedValue = useDebounce(value, 1000);

Debouncing a function

Great for when you don't want to use useState.

import { debouncer } from "any-debounce";

const handleOnChange = debouncer((value) => {
    console.log(value);
    //do something with the value
}, 1000);

used any-debounce 0.0.2? see breaking changes below.

Breaking Changes

  • useDebounce is now debounceValue for debouncing a value
  • debouncer is the new debounce for debouncing a function
0.0.3

9 months ago

0.0.2

10 months ago

0.0.1

10 months ago