]> git.wh0rd.org - tt-rss.git/blame - lib/dojo/topic.js.uncompressed.js
modify dojo rebuild script to remove uncompressed files
[tt-rss.git] / lib / dojo / topic.js.uncompressed.js
CommitLineData
f0cfe83e
AD
1define("dojo/topic", ["./Evented"], function(Evented){
2
3 // module:
4 // dojo/topic
5
6 var hub = new Evented;
7 return {
8 // summary:
9 // Pubsub hub.
10 // example:
11 // | topic.subscribe("some/topic", function(event){
12 // | ... do something with event
13 // | });
14 // | topic.publish("some/topic", {name:"some event", ...});
15
16 publish: function(topic, event){
17 // summary:
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).
21 // topic: String
22 // The name of the topic to publish to
23 // event: Object
24 // An event to distribute to the topic listeners
25 return hub.emit.apply(hub, arguments);
26 },
27
28 subscribe: function(topic, listener){
29 // summary:
30 // Subscribes to a topic on the pub/sub hub
31 // topic: String
32 // The topic to subscribe to
33 // listener: Function
34 // A function to call when a message is published to the given topic
35 return hub.on.apply(hub, arguments);
36 }
37 };
38});