Name: broway
Owner: AutoScout24
Owner: AutoScout24
Description: PubSub with memory
Created: 2016-06-09 12:15:20.0
Updated: 2016-06-10 07:35:56.0
Pushed: 2016-06-10 10:58:58.0
Homepage: null
Size: 10
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
PubSub with the history. Broway is just a cool name.
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:
ailbox('myMailBox').send(1);
ailbox('myMailBox').send('another message');
..
ailbox('myMailBox').read(console.log.bind(console)) // 1 ... 'another message'
s
ailbox('myMailBox').send(1);
ailbox('myMailBox').send('another message');
..
ailbox('myMailBox').read(console.log.bind(console)) // 1 ... 'another message'
ailbox('myMailBox').send(2);
ogs "2" from the first reader
reate another reader
ailbox('myMailBox').read(console.log.bind(console)) // 1, 'another message', 2
ailbox('myMailBox').send(3);
ogs "3" two times as we now have two readers
subscribe
function that will register the reader but only for the new messages. Old school pubsub.PubSub with the history. Broway is just a cool name.
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:
ailbox('myMailBox').send(1);
ailbox('myMailBox').send('another message');
..
ailbox('myMailBox').read(console.log.bind(console)) // 1 ... 'another message'
s
ailbox('myMailBox').send(1);
ailbox('myMailBox').send('another message');
..
ailbox('myMailBox').read(console.log.bind(console)) // 1 ... 'another message'
ailbox('myMailBox').send(2);
ogs "2" from the first reader
reate another reader
ailbox('myMailBox').read(console.log.bind(console)) // 1, 'another message', 2
ailbox('myMailBox').send(3);
ogs "3" two times as we now have two readers
subscribe
function that will register the reader but only for the new messages. Old school pubsub.