Javascript PubSub

Built into Cantemo is a pubsub system for publishing to a channel and subscribing to a channel. The handle is a function that will be called if an event is published. It will receive the list of arguments from the publish statement:

$.subscribe("/some/topic", handle1);
$.subscribe("/some/topic", handle2);

$.publish("/some/topic", ["a","b","c"]);

$.unsubscribe("/some/topic", handle1);

console.log($.subscribers("/some/topic"));

As you can see from the above example, you can subscribe multiple subscribers to the same topic, have a publisher post an event on the channel of a list. You can also unsubscribe and list the subscribers.

Existing channels

Some existing channels are already set up.

channel

Variables

Description

/cntmo/prtl/item/delete

ID

Raised whenever the UI is doing a delete operation on an item.

/cntmo/prtl/MediaBin/ready

Raised when the MediaBin is ready and loaded

/cntmo/prtl/Mediabin/finishedAdding

Raised when items are finished adding things to the MediaBin