# debounce-decorator-ts

> Simple debounce decorator for functions

Latest version **1.0.4** (published 2018-08-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install debounce-decorator-ts
pnpm add debounce-decorator-ts
yarn add debounce-decorator-ts
bun add debounce-decorator-ts
```

## 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 | 1.0.4 |
| Published | 2018-08-29 |
| First published | 2018-08-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=6.0.0 |
| Dependencies | 0 |
| Unpacked size | 12.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Krzysztof Nofz |
| Maintainers | zgrybus |
| Keywords | debounce, debounceTime, decorator, debounce-decorator, typescript, optimize |

## Links

- npm: https://www.npmjs.com/package/debounce-decorator-ts
- Repository: https://github.com/zgrybus/debounce-decorator-ts
- Homepage: https://zgrybus.github.io/debounce-decorator-ts/
- Issues: https://github.com/zgrybus/debounce-decorator-ts/issues
- npm.io page: https://npm.io/package/debounce-decorator-ts

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 1.0.4 (latest) — 2018-08-29
- 1.0.2 — 2018-08-29
- 1.0.1 — 2018-08-29
- 1.0.0 — 2018-08-29

## README

# **DEBOUNCE-DECORATOR**

  * [About](#about)
  * [Install](#install)
  * [API](#api)
  * [Usage](#usage)
  * [License](#license)
  

## **ABOUT**

Simple function debounce decorator written in Typescript. 
* Has no dependencies.
* Very tiny < 1kb
* Very easy to use

An live example of function use: [Live Example](https://zgrybus.github.io/debounce-decorator-ts/)

## **INSTALL**

Install package by npm

```npm
  npm install --save-dev debounce-decorator-ts
```


## **API**

**SYNTAX**

```javascript
   @debounceFn(debounceTime, timeoutPropertyName);
```


**Properties**

* `debounceTime`  
**Action**: Setting debounceTimer  
**Default value**: `100` (ms)  
**Argument type**: number ( miliseconds )  

* `timeoutPropertyName`  
**Action**: Setting timeout property name ( for clearTimeout )  
**Default value**: `'timeoutFn'`  
**Argument type**: string   


## **USAGE**


**Basic usage**

```javascript
    import { debounceFn } from "debounce-decorator-ts";

    class MyClass {
    	constructor() {
    	    window.addEventListener('resize', this.onResizeFn.bind(this));
    	}
    	
    	@debounceFn()
    	private onResizeFn(e: Event): void {
    	    console.log('resized!');
    	}
    }

    const myClass = new MyClass;
```


**Override default properties value**

```javascript
    import { debounceFn } from "debounce-decorator-ts";

    class MyClass {
    	constructor() {
    	    window.addEventListener('resize', this.onResizeFn.bind(this));
    	}
    	
    	@debounceFn(1000, 'myCustomTimeoutPropertyName')
    	private onResizeFn(e: Event): void {
    	    console.log('resized!');
    	}
    }

    const myClass = new MyClass;
```


## **LICENSE**


[MIT](https://en.wikipedia.org/wiki/MIT_License) License

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