# on-cooldown

> Put functions on cooldown

Latest version **0.3.0** (published 2014-12-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install on-cooldown
pnpm add on-cooldown
yarn add on-cooldown
bun add on-cooldown
```

## 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.3.0 |
| Published | 2014-12-10 |
| First published | 2014-12-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Karl Brightman |
| Maintainers | karlbright |
| Keywords | helper, cooldown, timeout, function, delay, hubot, twitch |

## Links

- npm: https://www.npmjs.com/package/on-cooldown
- Repository: https://github.com/karlbright/on-cooldown
- Issues: https://github.com/karlbright/on-cooldown/issues
- npm.io page: https://npm.io/package/on-cooldown

## Alternatives

- [lodash.assign](https://npm.io/package/lodash.assign.md) — 2.3M weekly downloads
- [lodash.chunk](https://npm.io/package/lodash.chunk.md) — 1.8M weekly downloads
- [react-native-ios-utilities](https://npm.io/package/react-native-ios-utilities.md) — 138.5K weekly downloads
- [@technically/lodash](https://npm.io/package/@technically/lodash.md) — 50.9K weekly downloads
- [@fluid-topics/ft-icon](https://npm.io/package/@fluid-topics/ft-icon.md) — 20.6K weekly downloads

## Recent versions

- 0.3.0 (latest) — 2014-12-10
- 0.2.0 — 2014-12-10
- 0.1.0 — 2014-12-10

## README

# On Cooldown [![Build Status](https://travis-ci.org/karlbright/on-cooldown.svg?branch=master)](https://travis-ci.org/karlbright/on-cooldown)

> Simple library for creating functions with cooldowns

## Example


### Basic
```javascript
var cooldown = require('on-cooldown');

var fn = cooldown(1000, function(name) {
  console.log("Hello there " + name + "!");
});

fn.on('cooldown.calledOnCooldown', function(func, args) {
  console.log("Function could not be called, it is on cooldown, sorry " + args[0]);
});

fn.on('cooldown.start', function() {
  console.log("Cooldown has been started");
});

fn.on('cooldown.end', function() {
  console.log("Cooldown has ended");
});

fn("Karl")
fn("Bryan");
```

### Basic Bot
```javascript
var cooldown = require('on-cooldown');

robot.respond(/gems$/i, cooldown(300000, function(msg) {
  // This message will only be send when called, once every 5 minutes
  msg.send('Hello world');
});
```

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