# stormcloud

> Throttle and debounce

Latest version **0.5.9** (published 2020-06-20) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.5.9 |
| Published | 2020-06-20 |
| First published | 2020-06-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 45.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | panphora |
| Maintainers | panphora |
| Keywords | throttle, debounce |

## Links

- npm: https://www.npmjs.com/package/stormcloud
- Repository: https://github.com/panphora/stormcloud
- Homepage: https://github.com/panphora/stormcloud#readme
- Issues: https://github.com/panphora/stormcloud/issues
- npm.io page: https://npm.io/package/stormcloud

## Dependencies (2)

- [microbundle](https://npm.io/package/microbundle.md) ^0.12.0
- [concurrently](https://npm.io/package/concurrently.md) ^5.2.0

## Recent versions

- 0.5.9 (latest) — 2020-06-20
- 0.5.8 — 2020-06-20
- 0.5.6 — 2020-06-20
- 0.5.5 — 2020-06-20
- 0.5.4 — 2020-06-20
- 0.5.3 — 2020-06-20
- 0.5.2 — 2020-06-20
- 0.5.1 — 2020-06-20
- 0.5.0 — 2020-06-20

## README

# Stormcloud

A simple library for delaying function calls.

Includes `throttle` and `debounce`. 

[Read about throttle and debounce](https://css-tricks.com/debouncing-throttling-explained-examples/)

## Demo

[See It in Action](http://stormcloud.davidmiranda.info/demo/)

## Install

```
npm install stormcloud
```

## How to Use

```js
import {throttle, debounce} from "stormcloud";

let consoleLogThrottled = throttle(function () {
  console.log("throttle")
}, 1000);

let consoleLogDebounced = debounce(function () {
  console.log("debounce")
}, 1000);

window.addEventListener('scroll', function(e) {
  consoleLogThrottled();
  consoleLogDebounced();
});
```

## How it Works

### `throttle`

```javascript
let throttledFunction = throttle(originalFunction, 500);
```

If `throttledFunction` is called more often than every `500` milliseconds, it will be slowed down to being called every `500` milliseconds.

### `debounce`

```javascript
let debouncedFunction = debounce(originalFunction, 500);
```

If `debouncedFunction` is called more often than every `500` milliseconds, it will not be called until there's a gap of more than `500` milliseconds between calls.

## License

MIT

## Happy Coding ✌️

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