New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

broway

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

broway

PubSub with history

latest
Source
npmnpm
Version
0.3.0
Version published
Maintainers
1
Created
Source

broway

PubSub with the history. Broway is just a cool name.

Intro

We want to have a way to make modules communicate without thinking which one has been loaded before.

A Reader can reach all the messages that has been sent to the mailbox before it was created:

M2.mailbox('myMailBox').send(1);
M2.mailbox('myMailBox').send('another message');
// ...
M2.mailbox('myMailBox').read(console.log.bind(console)) // 1 ... 'another message'
M2.mailbox('myMailBox').send(1);
M2.mailbox('myMailBox').send('another message');
// ...
M2.mailbox('myMailBox').read(console.log.bind(console)) // 1 ... 'another message'

M2.mailbox('myMailBox').send(2);
// logs "2" from the first reader

// Create another reader
M2.mailbox('myMailBox').read(console.log.bind(console)) // 1, 'another message', 2

M2.mailbox('myMailBox').send(3);
// Logs "3" two times as we now have two readers 

Roadmap

  • add a subscribe function that will register the reader but only for the new messages. Old school pubsub.
  • mailbox will become a Functor.

Keywords

pubsub

FAQs

Package last updated on 10 Jun 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts