# tiny-events

> A very tiny EventEmitter implementation for client- and server-side code.

Latest version **1.0.1** (published 2014-11-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install tiny-events
pnpm add tiny-events
yarn add tiny-events
bun add tiny-events
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2014-11-12 |
| First published | 2014-11-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | ZauberNerd |
| Maintainers | zaubernerd |
| Keywords | eventemitter, emitter, event, events, mediator |

## Links

- npm: https://www.npmjs.com/package/tiny-events
- Repository: https://github.com:ZauberNerd/tiny-events
- Homepage: https://github.com/ZauberNerd/tiny-events
- Issues: https://github.com/ZauberNerd/tiny-events/issues
- npm.io page: https://npm.io/package/tiny-events

## 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

- 1.0.1 (latest) — 2014-11-12

## README

# tiny-events [![Build Status][0]][1] [![Coverage Status][2]][3]
[![Sauce Test Status][4]][5]

A very tiny (*400b*) EventEmitter implementation for client- and server-side code.


## installation
`npm install --save tiny-events`


## usage
instantiate the object directly..

```javascript
// import the module
var EventEmitter = require('tiny-events').EventEmitter;

// instantiate the object
var events = new EventEmitter();

// listen to 'foo' events
events.on('foo', function (data) {
    console.log('foo occured!');
});

// emit a 'foo' event
events.emit('foo');

// emit a 'foo' event with some data
events.emit('foo', 'hello world');

// remove all foo event listeners
events.off('foo');
```

... or subclass it.
```javascript
var utils = require('utils');
var EventEmitter = require('tiny-events').EventEmitter;

function MyClass() {
    EventEmitter.call(this);
}

util.inherits(MyClass, EventEmitter);
```


## API

- `on(type: string, listener: Function): EventEmitter`
- `once(type: string, listener: Function): EventEmitter`
- `off(type: string, listener?: Function): EventEmitter`
- `emit(type: string, ...args: any[]): EventEmitter`

[0]: https://img.shields.io/travis/ZauberNerd/tiny-events.svg
[1]: https://travis-ci.org/ZauberNerd/tiny-events
[2]: https://img.shields.io/coveralls/ZauberNerd/tiny-events.svg
[3]: https://coveralls.io/r/ZauberNerd/tiny-events?branch=master
[4]: https://saucelabs.com/browser-matrix/dom2wg-eventemitter.svg
[5]: https://saucelabs.com/u/dom2wg-eventemitter

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