# seng-disposable-manager

> Utility class for cleaning up various destructible things like timeouts, disposable instances and whatever you want to add.

Latest version **2.0.0** (published 2020-05-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install seng-disposable-manager
pnpm add seng-disposable-manager
yarn add seng-disposable-manager
bun add seng-disposable-manager
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2020-05-08 |
| First published | 2018-07-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 12.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Ricco Arntz |
| Maintainers | riccoarntz |
| Keywords | seng, mediamonks, boilerplate, seng-disposable-manager |

## Links

- npm: https://www.npmjs.com/package/seng-disposable-manager
- Repository: https://github.com/riccomediamonks/seng-disposable-manager
- Homepage: https://www.mediamonks.com/
- Issues: https://github.com/riccomediamonks/seng-disposable-manager/issues
- npm.io page: https://npm.io/package/seng-disposable-manager

## Dependencies (1)

- [@babel/runtime](https://npm.io/package/@babel/runtime.md) ^7.0.0-beta.35

## Recent versions

- 2.0.0 (latest) — 2020-05-08
- 1.0.3 — 2018-07-11

## README

# seng-disposable-manager
Utility class for cleaning up dispose functions.

## Installation
### yarn / npm

```sh
yarn add seng-disposable-manager
```

```sh
npm i -S seng-disposable-manager
```

## Usage

#### Constructing and adding disposable items.
```
  // Construct
  const instance = new DisposableManager();

  // Disposable item
  const fooBar = {
    dispose: () => {}
  };

  // Add disposable item
  instance.add(fooBar.dispose);

  // Add interval (use the setInterval of this module)
  instance.add(
    setInterval(() => {
      foo();
    }, 500)
  );

    // Add timeout (use the setTimeout of this module)
  instance.add(
    setTimeout(() => {
      foo();
    }, 500)
  );
```

#### Disposing DisposableManager
This will clean up all the added functions.
```
  disposableManagerInstance.dispose();
```


## Building

In order to build seng-disposable-manager, ensure that you have [Git](http://git-scm.com/downloads) and [Node.js]
(http://nodejs
.org/) installed.

Clone a copy of the repo:
```sh
git clone https://github.com/riccomediamonks/seng-disposable-manager.git
```

Change to the seng-disposable-manager directory:
```sh
cd seng-disposable-manager
```

Install dev dependencies:
```sh
yarn
```

Use one of the following main scripts:
```sh
yarn build           # build this project
yarn dev             # run dev-watch mode, serving example/index.html in the browser
yarn generate        # generate all artifacts (compiles ts, webpack, docs and coverage)
yarn test:unit       # run the unit tests
yarn validate        # runs validation scripts, including test, lint and coverage check
yarn lint            # run tslint on this project
yarn doc             # generate typedoc documentation
```

When installing this module, it adds a pre-push hook, that runs the `validate`
script before committing, so you can be sure that everything checks out.

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