# @skymapglobal/event-bus

> ## Overview

Latest version **1.0.2** (published 2020-10-06) · GPL-3.0-only license · 0 weekly downloads

## Install

```sh
npm install @skymapglobal/event-bus
pnpm add @skymapglobal/event-bus
yarn add @skymapglobal/event-bus
bun add @skymapglobal/event-bus
```

## 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.2 |
| Published | 2020-10-06 |
| First published | 2020-04-23 |
| Weekly downloads | 0 |
| License | GPL-3.0-only |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 46.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Duc Vu |
| Maintainers | ducvt7593 |

## Links

- npm: https://www.npmjs.com/package/@skymapglobal/event-bus
- npm.io page: https://npm.io/package/@skymapglobal/event-bus

## Recent versions

- 1.0.2 (latest) — 2020-10-06
- 1.0.1 — 2020-04-23
- 1.0.0 — 2020-04-23

## README

# Event Bus

## Overview

Creating an event bus for pub/sub.
Same api with Vue, used for replacing Vue with lightweight size.

## Install

```bash
yarn add @skymapglobal/event-bus
```

## Usage

```javascript
import { EventBus } from "@skymapglobal/event-bus";

const bus = new EventBus();

bus.$on("my-event", (a, b) => {
  console.log(a, b);
});

bus.$emit("my-event", 'a', 'b');
```

## API

### $on(event, listener)

* event: String - event name
* listener: (...params) => void - callback

### $once(event, listener)

* event: String - event name
* listener: (...params) => void - callback

### $emit(event, ...params)

* event: String - event name
* params?: any[] - any params

### $off(event, listener)

* event?: String - event name, ignore to off all
* listener?: Function - callback, ignore to remove all listeners in event

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