]>
git.wh0rd.org - tt-rss.git/blob - lib/dojo/topic.js.uncompressed.js
1 define("dojo/topic", ["./Evented"], function(Evented
){
11 // | topic.subscribe("some/topic", function(event){
12 // | ... do something with event
14 // | topic.publish("some/topic", {name:"some event", ...});
16 publish: function(topic
, event
){
18 // Publishes a message to a topic on the pub/sub hub. All arguments after
19 // the first will be passed to the subscribers, so any number of arguments
20 // can be provided (not just event).
22 // The name of the topic to publish to
24 // An event to distribute to the topic listeners
25 return hub
.emit
.apply(hub
, arguments
);
28 subscribe: function(topic
, listener
){
30 // Subscribes to a topic on the pub/sub hub
32 // The topic to subscribe to
34 // A function to call when a message is published to the given topic
35 return hub
.on
.apply(hub
, arguments
);