# choke

> Function call throttling with hook for cancelling

Latest version **0.1.2** (published 2013-08-26) · 0 weekly downloads

## Install

```sh
npm install choke
pnpm add choke
yarn add choke
bun add choke
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.2 |
| Published | 2013-08-26 |
| First published | 2013-08-23 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Matt-Esch |
| Maintainers | mattesch |

## Links

- npm: https://www.npmjs.com/package/choke
- Repository: https://github.com/Matt-Esch/choke
- Issues: https://github.com/Matt-Esch/choke/issues
- npm.io page: https://npm.io/package/choke

## Recent versions

- 0.1.2 (latest) — 2013-08-26
- 0.1.1 — 2013-08-24
- 0.1.0 — 2013-08-23

## README

# choke

<!-- [![browser support][5]][6] -->

<!-- [![build status][1]][2] [![NPM version][7]][8] [![dependency status][3]][4] -->

Function call throttling with hook for cancelling

[![browser support](https://ci.testling.com/USER/PROJECT.png)](https://ci.testling.com/USER/PROJECT)

## Example

```js
var choke = require("choke")
var EventSource = require("eventsource-reconnect")
var setInterval = require("timers").setInterval

var source = new EventSource("http://localhost:1234/events")
var reconnect = choke(source.reconnect, 15000)

source.onopen = reconnect.cancel    // kill any outstanding reconnect attempts

setInterval(function ()) {
    if (source.readyState === source.CLOSED) {
        source.onclose = reconnect.listener // throttle reconnects to 15 secs
    }
}, 1000)
```

## Installation

`npm install choke`

## Contributors

 - Matt-Esch

## MIT Licenced

  [1]: https://secure.travis-ci.org/Matt-Esch/choke.png
  [2]: https://travis-ci.org/Matt-Esch/choke
  [3]: https://david-dm.org/Matt-Esch/choke.png
  [4]: https://david-dm.org/Matt-Esch/choke
  [5]: https://ci.testling.com/Matt-Esch/choke.png
  [6]: https://ci.testling.com/Matt-Esch/choke
  [7]: https://badge.fury.io/js/choke.png
  [8]: https://badge.fury.io/js/choke

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