# janitorjs

> janitor.js ==========

Latest version **0.0.4** (published 2013-12-02) · BSD-2-Clause license · 0 weekly downloads

## Install

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

## 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.0.4 |
| Published | 2013-12-02 |
| First published | 2013-11-18 |
| Weekly downloads | 0 |
| License | BSD-2-Clause |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | architectd |

## Links

- npm: https://www.npmjs.com/package/janitorjs
- Repository: https://github.com/classdojo/janitor.js
- Issues: https://github.com/classdojo/janitor.js/issues
- npm.io page: https://npm.io/package/janitorjs

## Dependencies (2)

- [protoclass](https://npm.io/package/protoclass.md) 0.0.x
- [type-component](https://npm.io/package/type-component.md) 0.0.1

## Recent versions

- 0.0.4 (latest) — 2013-12-02
- 0.0.2 — 2013-11-18
- 0.0.1 — 2013-11-18

## README

Janitor.js is a simple utility that helps cleanup objects. [![Alt ci](https://travis-ci.org/classdojo/janitor.js.png)](https://travis-ci.org/classdojo/janitor.js)

### installation

Via NPM:

```bash
npm install janitorjs
```

Via Bower:

```bash
bower install janitor
```

### API

#### janitor()

Creates a new janitor

#### janitor.add(fnOrDisposable)

adds a disposable item to be cleaned up later.

```javascript

// function
janitor.add(function() {
  
});


// *or* object with .dispose() method
janitor.add({
  dispose: function() {

  }
});
```

#### janitor.addTimeout(timer)

adds a timeout object

```javascript
janitor.addTimeout(setTimeout(function() {
  
}, 1000));
```

#### janitor.addInterval(timer)

adds an interval object

```javascript
janitor.addInterval(setInterval(function() {
  
}, 100));
```

#### janitor.dispose()

```javascript
janitor.add(function() { });
janitor.addInterval(setInterval(functon(){}, 100));

//call the first fn, and dispose the interval
janitor.dispose();
```

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