# onfire.js

> onfire.js is a mini (~500 b) version for event-emitter.

Latest version **2.0.1** (published 2019-04-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install onfire.js
pnpm add onfire.js
yarn add onfire.js
bun add onfire.js
```

## 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 | 2.0.1 |
| Published | 2019-04-22 |
| First published | 2016-07-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 9.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 496 |
| Author | hustcc |
| Maintainers | atool |
| Keywords | onfire, ee, event, emitter, event-emitter, subscribe |

## Links

- npm: https://www.npmjs.com/package/onfire.js
- Repository: https://github.com/hustcc/onfire.js
- Homepage: https://github.com/hustcc/onfire.js#readme
- Issues: https://github.com/hustcc/onfire.js/issues
- npm.io page: https://npm.io/package/onfire.js

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

- 2.0.1 (latest) — 2019-04-22
- 2.0.0 — 2018-12-28
- 1.0.6 — 2016-08-22
- 1.0.5 — 2016-07-19
- 1.0.4 — 2016-07-18
- 1.0.3 — 2016-07-17
- 1.0.2 — 2016-07-16
- 1.0.1 — 2016-07-15
- 1.0.0 — 2016-07-15

## README

# onfire.js

> nano version (~ 500b) for event-emitter.

[![Build Status](https://travis-ci.org/hustcc/onfire.js.svg?branch=master)](https://travis-ci.org/hustcc/onfire.js)
[![npm](https://img.shields.io/npm/v/onfire.js.svg)](https://www.npmjs.com/package/onfire.js)


[中文文档](./README_zh.md) | [English Doc](./README.md)


## Install

> npm i --save onfire.js



## Usage

```js
import EE from 'onfire.js';

const ee = new EE();

ee.on('mouseover', () => {});

ee.once('click', () => {});

ee.fire('click', 1, 'hello', true);

ee.off('click');
```



## API

Simple and similar with `event-emitter`.


 - `on(eventName: string, callback: Function)`: listen an event.
 - `once(eventName: string, callback: Function)`: listen a event only once.
 - `fire(eventName: string, ...parameters: any[])`: emit / trigger an event with parameters.
 - `off(eventName?: string, callback?: Function)`: unsubscribe an event.



## Used

 - Events subscribe and dispatcher.
 - `Cross-component communication` for React / Vue / Angular.
 - System event mechanism.



## License

MIT@[hustcc](https://github.com/hustcc).

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