# func-throttle

> Small no-dependencies ES5 utility to implement simple function calls throttling.

Latest version **1.0.0** (published 2018-07-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install func-throttle
pnpm add func-throttle
yarn add func-throttle
bun add func-throttle
```

## 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.0 |
| Published | 2018-07-22 |
| First published | 2018-07-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 6.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Nikita Ivanov |
| Maintainers | grafgenerator |
| Keywords | func-throtlle, function-throttle, func, function, throttle, throttling, debounce, func-debounce |

## Links

- npm: https://www.npmjs.com/package/func-throttle
- Repository: https://github.com/GrafGenerator/func-throttle
- Homepage: https://github.com/GrafGenerator/func-throttle#readme
- Issues: https://github.com/GrafGenerator/func-throttle/issues
- npm.io page: https://npm.io/package/func-throttle

## Recent versions

- 1.0.0 (latest) — 2018-07-22

## README

# func-throttle
Small no-dependencies ES5 utility to implement simple function calls throttling.

# Example usage
func-throttle is available either as node package or global function.

In NodeJS environment do classic:
```js
var FuncThrottle = require("func-throttle");
```

For usage as global function just include the script into the page:
```html
<script src="func-throttle.js" />
```
It will create window.FuncThrottle variable which can be used directly as `FuncThrottle

Then use func-throttle to create throttled version of your function:
```js
    var requestDataFunc = function(){
        // fetch data from some URL
    };

    var throttledRequest = FuncThrottle(testFunc, Promise)
        .occurs(2) // twice
        .per(1000); // per second

    someForm.on("submit", function(){
        throttledRequest
            .then(function(result){
                // re-render view
            });
    });
```

See [test.js](test/test.js) for more usage examples.

# Development
Run `npm i` to install required dependencies, and `npm test` to execute a bunch of unit-tests to control the integrity of func-throttle.

# License
MIT

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