An open API service indexing awesome lists of open source software.

https://github.com/superraytin/light-pub-sub

Light pub/sub library for Javascript
https://github.com/superraytin/light-pub-sub

Last synced: 2 months ago
JSON representation

Light pub/sub library for Javascript

Awesome Lists containing this project

README

        

# light-pub-sub
Light pub/sub library for Javascript

# Quick Start

```js
const broadcaster = require('light-pub-sub')

// subscribe
broadcaster.on('abc', ({ data }) => {
console.log(data) // 123
})

// publish
broadcaster.emit('abc', 123)
```

# Usage

### broadcaster.on(channel, fn)

### broadcaster.once(channel, fn)

### broadcaster.emit(channel, data)

### broadcaster.off(channel, fn)

### broadcaster.offAll(channel)