diff options
author | Richard Beales <[email protected]> | 2013-03-18 07:32:01 +0000 |
---|---|---|
committer | Richard Beales <[email protected]> | 2013-03-18 07:32:01 +0000 |
commit | 7c97d17aaf373339a8bcd917ad59ca6018148f0d (patch) | |
tree | 5a3c04f0f9529be392c1263d3feb75806eb43797 /lib/dojo/topic.js.uncompressed.js | |
parent | 70db7424e7068701e60cc5bcdfe8f858be508179 (diff) | |
parent | c670a80ddd9b03bd4ea6d940a9ed682fd26248d7 (diff) |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'lib/dojo/topic.js.uncompressed.js')
-rw-r--r-- | lib/dojo/topic.js.uncompressed.js | 38 |
1 files changed, 38 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..35e193739 --- /dev/null +++ b/lib/dojo/topic.js.uncompressed.js @@ -0,0 +1,38 @@ +define("dojo/topic", ["./Evented"], function(Evented){ + + // module: + // dojo/topic + + var hub = new Evented; + return { + // summary: + // Pubsub hub. + // example: + // | topic.subscribe("some/topic", function(event){ + // | ... do something with event + // | }); + // | topic.publish("some/topic", {name:"some event", ...}); + + 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: + // Subscribes 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); + } + }; +}); |