# callback-collections

> Set of collections with remove and add callback.

Latest version **1.0.1** (published 2016-12-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install callback-collections
pnpm add callback-collections
yarn add callback-collections
bun add callback-collections
```

## 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 | 1.0.1 |
| Published | 2016-12-21 |
| First published | 2016-09-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | yes |
| GitHub stars | 1 |
| Author | Mariusz Gęzicki |
| Maintainers | mariusz-v7 |
| Keywords | mrugames, utils, dictionary, autoincrement |

## Links

- npm: https://www.npmjs.com/package/callback-collections
- Repository: https://github.com/Mariusz-v7/callback-collections
- Homepage: https://github.com/Mariusz-v7/callback-collections#readme
- Issues: https://github.com/Mariusz-v7/callback-collections/issues
- npm.io page: https://npm.io/package/callback-collections

## Dependencies (1)

- [systemjs](https://npm.io/package/systemjs.md) ^0.19.38

## Recent versions

- 1.0.1 (latest) — 2016-12-21
- 1.0.0 — 2016-09-18

## README

# callback-collections
Simple classes which allows to call a function when element is added to or removed from collection.

Features
--------
- add, get, remove elements from the collection
- set a callback function which will be called on add or remove element

Installation
------------
```
npm install callback-collections --save
```

Configuration
-------------
All compiled sources are under dist/main directory.

You should use dist/main/index.js as an entry point.

E.g. you can copy all files from dist/main and paste them under callback-collections in your lib directory,
then, if you use SystemJS, add an entry in map section:
```
map: { 'callback-collections':     'libs/callback-collections/index' }
```

Usage
-----
Collection of strings, with on-remove callback:

```typescript
import {RemoveCallbackCollection} from 'callback-collections';

let collection = new RemoveCallbackCollection<string>((el:string) => {
    console.log('removed element: ' + el);
});

// add element to collection (add() method returns a numeric value associated with inserted element)
let id = collection.add("test string");

//now, removing element under given id, wil result in "removed element: test string" message
collection.remove(id);
```

See more examples unter src/test directory.

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