svelte-use-debounce
v0.0.2
Published
The use directive for debounce.
Downloads
13
Readme
svelte-use-debounce
The use directive for debounce.
Installation
npm i svelte-use-debounce
Usage
<script>
import {debounce} from "svelte-use-debounce";
</script>
<input use-debounce={{ms: 300, callback: (value) => { ... }}} />
Typescript Support
<script lang="ts">
import {debounce, type DebounceOptions} from "svelte-use-debounce";
const opts: DebounceOptions = {
ms: 300,
callback: (value: string) => {...}
};
</script>
<input use-debounce={opts} />
Options
| Option | Type | Description | | -------- | ---------------------- | --------------------------------- | | ms? | Number | Sets the debounce time. | | callback | (str: string) => void; | Callback to run when it debounces |