# @f/debounce

> Debounce a function

Latest version **1.0.5** (published 2016-10-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install @f/debounce
pnpm add @f/debounce
yarn add @f/debounce
bun add @f/debounce
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.5 |
| Published | 2016-10-27 |
| First published | 2016-03-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Maintainers | f |

## Links

- npm: https://www.npmjs.com/package/@f/debounce
- Repository: https://github.com/micro-js/debounce
- Homepage: https://github.com/micro-js/debounce#readme
- Issues: https://github.com/micro-js/debounce/issues
- npm.io page: https://npm.io/package/@f/debounce

## Recent versions

- 1.0.5 (latest) — 2016-10-27
- 1.0.4 — 2016-08-11
- 1.0.3 — 2016-08-11
- 1.0.2 — 2016-06-10
- 1.0.1 — 2016-06-10
- 1.0.0 — 2016-03-09

## README

# debounce

[![Build status][travis-image]][travis-url]
[![Git tag][git-image]][git-url]
[![NPM version][npm-image]][npm-url]
[![Code style][standard-image]][standard-url]

Debounce a function

## Installation

    $ npm install @f/debounce

## Usage

Debounce takes a function and a time in milliseconds and returns a function that, once called, will not run until `time` milliseconds have elapsed and will drop all subsequent calls in the interim period. This is useful if you have an event that might happen many times in a short period but that you only want to respond to once after they have all stopped, e.g.

```js
var debounce = require('@f/debounce')
window.addEventListener('resize', debounce(relayout))
```

## API

### debounce(fn, time)

- `fn` - The function you want to debounce
- `time` - The time in milliseconds. Defaults to 0.

**Returns:** A debounced version of `fn`. Each time `fn` is called, it will return a `cancel` function that you can use to cancel the invocation of `fn`.

## License

MIT

[travis-image]: https://img.shields.io/travis/micro-js/debounce.svg?style=flat-square
[travis-url]: https://travis-ci.org/micro-js/debounce
[git-image]: https://img.shields.io/github/tag/micro-js/debounce.svg?style=flat-square
[git-url]: https://github.com/micro-js/debounce
[standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square
[standard-url]: https://github.com/feross/standard
[npm-image]: https://img.shields.io/npm/v/@f/debounce.svg?style=flat-square
[npm-url]: https://npmjs.org/package/@f/debounce

---
_Source: https://npm.io/package/@f/debounce · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
