rauricoste-event-stream-sync
v0.0.2
Published
Summary ======
Downloads
8
Readme
Summary
It is a simple object for to publish messages to listeners. Messages are transmitted synchronously.
Exemple
const EventStream = require("rauricoste-event-stream-sync")
const stream = new EventStream()
EventStream class
subscribe(fct: Function)
: add thefct
as a listener of published messages.publish(message: Any)
: execute all listeners withmessage
as its argument. Execution is synchronous and sequential.subEventStream(key: String)
: create anEventStream
object that listens only on messages that are objects and have a value associated tokey
key and publishing only this value. Publishing on a sub EventStream does not publish on the parent EventStream.