Courier.js
Simple pub-sub for JavaScript.
Using it
var courier = ; // subscribing to a messagecourier; // sending a new message// the first parameter is the message identifier// the second parameter can be anything// and will just be forwarded to the receivercourier; // to avoid an exeception while sending messages// not yet defined receivers set throwOnMissing: falsecourier; // you can also subscribe and send with Regular expressions courier; courier;
Unsubscribe
Courier allows you to unsubscribe to any message with the given receiver returned function, like so:
var unsubscribe = courier;