# tinyevent

> event dispatcher

Latest version **0.1.3** (published 2017-04-04) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

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

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.1.3 |
| Published | 2017-04-04 |
| First published | 2016-12-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | joje |
| Maintainers | attrs, joje |
| Keywords | event, dispatcher, attrs, hierarchical |

## Links

- npm: https://www.npmjs.com/package/tinyevent
- Repository: https://github.com/attrs/tinyevent
- Issues: https://github.com/attrs/tinyevent/issues
- npm.io page: https://npm.io/package/tinyevent

## Alternatives

- [async-exit-hook](https://npm.io/package/async-exit-hook.md) — 3.7M weekly downloads
- [evnty](https://npm.io/package/evnty.md) — 7.2K weekly downloads
- [eleventy-plugin-asciidoc](https://npm.io/package/eleventy-plugin-asciidoc.md) — 3.5K weekly downloads
- [@jswork/next-get2get](https://npm.io/package/@jswork/next-get2get.md) — 945 weekly downloads
- [@dashersw/axon](https://npm.io/package/@dashersw/axon.md) — 934 weekly downloads

## Recent versions

- 0.1.3 (latest) — 2017-04-04
- 0.2.1 — 2017-03-25
- 0.2.0 — 2017-03-22
- 0.1.2 — 2017-03-13
- 0.1.1 — 2017-02-10
- 0.1.0 — 2016-12-28

## README

# tinyevent

A tiny event dispatcher

[![NPM Version][npm-version]][npm-url] [![NPM Downloads][npm-total]][npm-url] [![NPM Downloads][npm-month]][npm-url] [![NPM Downloads][license]][npm-url]

[npm-version]: https://img.shields.io/npm/v/tinyevent.svg?style=flat
[npm-url]: https://npmjs.org/package/tinyevent
[npm-total]: https://img.shields.io/npm/dt/tinyevent.svg?style=flat
[npm-month]: https://img.shields.io/npm/dm/tinyevent.svg?style=flat
[license]: https://img.shields.io/npm/l/tinyevent.svg?style=flat


## Installation
```sh
$ npm install tinyevent --save
```

## Usage
### commonjs
```javascript
var tinyevent = require('tinyevent');
```

### browser
```html
<script src="dist/tinyevent.min.js"></script>
```
```javascript
var tinyevent = window.tinyevent;
```

### Example
```javascript
var dispatcher = tinyevent();
var dispatcher2 = tinyevent();
dispatcher.connect(dispatcher2, 'up'); // up | down

var fn = function(e) {
  console.log(this, e.type, e.detail);
  
  //e.preventDefault();
  //e.stopPropagation();
  //e.stopImmediatePropagation();
};

dispatcher.on('myevent', fn);
dispatcher2.on('myevent', fn);
dispatcher.once('myevent', function(e) {});
dispatcher.off('myevent', fn);

if( dispatcher.fire('myevent', {a:1}) ) {
  var notprevented = dispatcher.fire('myevent', {a:2}, 'up');
}

dispatcher.disconnect(dispatcher2);

var b = dispatcher.has('myevent');
dispatcher.has(fn);
dispatcher.pause();
dispatcher.resume();

```

### License
Licensed under the MIT License.
See [LICENSE](./LICENSE) for the full license text.

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