Scenario: a script that is loaded/evaluated inside a ContentPane needs to subscribe to a topic that is publishing URLs, receive exactly one URL, and then reload the pane.
Option 1. Look up the topic and connectOnce to its "sendMessage" method. (Note: scripts evaluated inside a ContentPane use the "_container_" variable to access it).
if(_container_)
dojo.event.connectOnce(dojo.event.topic.getTopic("treeurl"), "sendMessage",
_container_, "setUrl");
Option 2. Use kwConnect with once:true.
if(_container_)
dojo.event.kwConnect({
once: true,
srcObj: dojo.event.topic.getTopic("treeurl"),
srcFunc: "sendMessage",
adviceObj: _container_,
adviceFunc: "setUrl"
});
Tested with Dojo 0.3 release.