# callbag-debounce

> debounce operator for callbag

Latest version **4.0.0** (published 2021-06-21) · 0 weekly downloads

## Install

```sh
npm install callbag-debounce
pnpm add callbag-debounce
yarn add callbag-debounce
bun add callbag-debounce
```

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 4.0.0 |
| Published | 2021-06-21 |
| First published | 2018-02-28 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 10.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 12 |
| Author | Thomas Belin |
| Maintainers | atomrc |
| Keywords | callbag |

## Links

- npm: https://www.npmjs.com/package/callbag-debounce
- Repository: https://github.com/atomrc/callbag-debounce
- Homepage: https://github.com/atomrc/callbag-debounce#readme
- Issues: https://github.com/atomrc/callbag-debounce/issues
- npm.io page: https://npm.io/package/callbag-debounce

## Dependencies (1)

- [callbag](https://npm.io/package/callbag.md) ^1.4.0

## Recent versions

- 4.0.0 (latest) — 2021-06-21
- 3.0.0 — 2021-03-05
- 2.1.3 — 2020-11-16
- 2.1.2 — 2018-04-27
- 2.1.1 — 2018-04-04
- 2.1.0 — 2018-03-05
- 2.0.0 — 2018-02-28
- 1.0.1 — 2018-02-28
- 1.0.0 — 2018-02-28

## README

# Callbag debounce

Debounce operator for [Callbag](https://github.com/callbag/callbag)

## Install

    npm i callbag-debounce

## Example

Debounces the `scroll` event and runs the `expensiveFunction` only when there is a 60ms pause.

```javascript
const { fromEvent, forEach, pipe } = require("callbag-basics");
import { debounce } from "callbag-debounce";

pipe(
  fromEvent(document, "scroll"),
  debounce(60),
  forEach(expensiveFunction)
);
```

## Changelog

### 4.0.0 (21/06/2021)

BREAKING CHANGE:

- Last value is flushed even if the stream is receiving a terminate signal before the value has been debounced (fixes #12)

Before

```js
pipe(
  of(42),
  debounce(1000),
  subscribe(console.log)
)
// Terminate without logging anything
```

After

```js
pipe(
  of(42),
  debounce(1000),
  subscribe(console.log)
)
// log: 42
// Then terminate
```

### 3.0.0 (05/03/2021)

BREAKING CHANGE:

- Timer is cleared when stream is terminated by sink (see #13)

### v2.1.0 (05/03/2018)

- `error` (`t === 2 && d !== undefined`) signals are sent right away (previously they were delayed according to the `wait` parameter);
- `complete` (`t === 2 && d === undefined`) signals are sent when the last value is debounced (previously they were debounced according to the `wait` parameter).

### v2.0.0 (01/03/2018)

codebase migrated to TypeScript.
The module needs to be imported via a named import

```javascript
import { debounce } from "callbag-debounce";
```

previously

```javascript
import debounce from "callbag-debounce";
```

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