diff options
author | Andrew Dolgov <[email protected]> | 2012-08-14 18:59:10 +0400 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2012-08-14 18:59:18 +0400 |
commit | 1354d17270961fff662d40f90521223f8fd0d73b (patch) | |
tree | e9266be71587e47c800303446e968a6d3565e2cf /lib/dojo/topic.js.uncompressed.js | |
parent | d04f8c826f5283765f52cf6b98b42a1ed8f2d6bc (diff) |
update dojo to 1.7.3
Diffstat (limited to 'lib/dojo/topic.js.uncompressed.js')
-rw-r--r-- | lib/dojo/topic.js.uncompressed.js | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/lib/dojo/topic.js.uncompressed.js b/lib/dojo/topic.js.uncompressed.js new file mode 100644 index 000000000..7fc63c7d5 --- /dev/null +++ b/lib/dojo/topic.js.uncompressed.js @@ -0,0 +1,33 @@ +define("dojo/topic", ["./Evented"], function(Evented){ + // summary: + // The export of this module is a pubsub hub + // You can also use listen function itself as a pub/sub hub: + // | topic.subscribe("some/topic", function(event){ + // | ... do something with event + // | }); + // | topic.publish("some/topic", {name:"some event", ...}); + + var hub = new Evented; + return { + publish: function(topic, event){ + // summary: + // Publishes a message to a topic on the pub/sub hub. All arguments after + // the first will be passed to the subscribers, so any number of arguments + // can be provided (not just event). + // topic: String + // The name of the topic to publish to + // event: Object + // An event to distribute to the topic listeners + return hub.emit.apply(hub, arguments); + }, + subscribe: function(topic, listener){ + // summary: + // Subcribes to a topic on the pub/sub hub + // topic: String + // The topic to subscribe to + // listener: Function + // A function to call when a message is published to the given topic + return hub.on.apply(hub, arguments); + } + } +}); |