postup
TypeScript icon, indicating that this package has built-in type declarations

4.0.1 • Public • Published

Postup

Multi channel message bus

Postup is a multi channel message bus written in TypeScript. It runs in the browser, or on the server using node.js.

Setup

yarn add postup

or

npm install --save postup

Usage

Before you start import the library

import Postup from 'postup'

Basic usage

// Setup a new bus with no buffer
const bus = new Postup()
const chan = bus.channel(['topic'])
 
// Data published can be anything
const context = { test: true }
 
// Setup a subscriber
const ubsubscribe = bus.subscribe((data, topic) => {
  console.log(data, topic) // { test: true } ["topic"]
})
 
// Publish some data
chan.publish(context)
 
// Cleanup
unsubsribe()

License

MIT

Package Sidebar

Install

npm i postup

Weekly Downloads

5

Version

4.0.1

License

MIT

Unpacked Size

23.7 kB

Total Files

14

Last publish

Collaborators

  • claudiuandrei