# postmessage-event-bus

> event bus based on post message

Latest version **0.0.2** (published 2019-11-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install postmessage-event-bus
pnpm add postmessage-event-bus
yarn add postmessage-event-bus
bun add postmessage-event-bus
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2019-11-19 |
| First published | 2019-11-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 18 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | zeyong.tsai |
| Maintainers | zeyong.tsai |
| Keywords | event, bus/post, message |

## Links

- npm: https://www.npmjs.com/package/postmessage-event-bus
- Repository: https://github.com/zeyongTsai/postmessage-event-bus
- Homepage: https://github.com/zeyongTsai/postmessage-event-bus#readme
- Issues: https://github.com/zeyongTsai/postmessage-event-bus/issues
- npm.io page: https://npm.io/package/postmessage-event-bus

## 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.0.2 (latest) — 2019-11-19
- 0.0.1 — 2019-11-13

## README

<!--
 * @Author: caizeyong
 * @Date: 2019-11-13 09:11:50
 * @Description: readme
 -->
# postmessage-event-bus
event bus based on post message

# Usage

## Install
1. ```npm i postmessage-event-bus``` and require it ```require('postmessage-event-bus')```
2. ```<script src="https://unpkg.com/postmessage-event-bus@0.0.1/eventBus.min.js"></script>```

## API
```javascript
CreatePostMessageEventBus({
    success: function () {
        console.log('registry successed')
    },
    receive: function (data) {
        console.log('receive post message data,data.name is message type', data, data.name)
    },
    request: function (cmd) {
        console.log('other window need u send some event. cmd is the message type', cmd)
        this.send({
            name: 'change', // message type
            sum: 100 // value
            ... // other values
        })
    },
    on: ['increase', 'decrease'], // events that u wanna listen
    emit: ['change'] // events that u will dispatch
})
```

## Demo
https://zeyongtsai.github.io/postmessage-event-bus/root.html

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