# gevent

> simple event bus for webapp

Latest version **1.0.4** (published 2016-11-29) · MIT license · 0 weekly downloads

## Install

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

## 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.4 |
| Published | 2016-11-29 |
| First published | 2016-11-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | qtx |
| Maintainers | qintx |
| Keywords | eventbus |

## Links

- npm: https://www.npmjs.com/package/gevent
- Repository: https://github.com/lkiarest/gevent
- Homepage: https://github.com/lkiarest/gevent#readme
- Issues: https://github.com/lkiarest/gevent/issues
- npm.io page: https://npm.io/package/gevent

## 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.4 (latest) — 2016-11-29
- 1.0.3 — 2016-11-29
- 1.0.2 — 2016-11-29
- 1.0.1 — 2016-11-28
- 1.0.0 — 2016-11-28

## README

A simple eventbus for webapp.

usage:

CMD:
```
// module A
var ge = require('gevent');
var uid1 = ge.on('dataChange', item => drawData(item));
var uid2 = ge.on('dataChange', item => drawData2(item));

// remove all by event type
ge.off('dataChange');
// or remove one by event id if you have duplicate event name registered
ge.offOne(uid1);

// module B
var ge = require('gevent');
doAsyncRequest().then(res => ge.emit('dataChange', res));
```

Js Lib:
```
<script src='./gevent/index.js'></script>
<script>
    // listen
    gEvent.on('dataChange', item => drawData(item));
    // fire
    doAsyncRequest().then(res => gEvent.emit('dataChange', res));
</script>
```

apis:

- __on(eventName, callback)__
  subscribe event

- __off(eventName)__
  unsubscribe all event by event name

- __offOne(eventId)__
  unsubscribe one event by event id

- __emit(eventName, params)__
  trigger event with transition data

- __clear()__
  clear all events subscribed

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