Opened 13 years ago

Closed 10 years ago

#10217 closed defect (wontfix)

dojo.connectPublisher simplification

Reported by: Les Owned by: dante
Priority: low Milestone: future
Component: Events Version: 1.4.0b
Keywords: dojo.connectPublisher needsreview Cc: James Burke, alex, elatzukin
Blocked By: Blocking:


I believe the dojo.connectPublisher function can be simplified. This is because the event param is not optional according to the inline doc. If it is optional, then the doc should be corrected.

dojo.connectPublisher = function( /*String*/ topic, 
	/*Object|null*/ obj, 
	/*String*/ event){

	var pf = function(){ dojo.publish(topic, arguments); };
	return dojo.connect(obj, event, pf); //Handle

Change History (7)

comment:1 Changed 13 years ago by dante

Milestone: tbd1.5
Owner: changed from anonymous to dante

comment:2 Changed 12 years ago by dante

so there isn't a test in place showing why one would ever use connectPublisher without an event. I tried to test this functionality, which I assume to be:

		function connectPublisherOptional(t){
			var obj = {
			function cb(){
			var handle = dojo.connectPublisher("/hmm", cb) /* null event */
			dojo.subscribe("/hmm", function(){
				alert("was published.");
			});, obj.val);
			cb();, obj.val);

though the subscription is never fired. I attempted also var cb = function(){} ... nothing seemed to publish on that topic.

comment:3 Changed 12 years ago by dante

Milestone: 1.51.6

moving this to 1.6 ... 1.5 is expected soon, and changing this _may_ be an API change, and i'm simply missing the use case.

comment:4 Changed 12 years ago by dante

Cc: alex elatzukin added

comment:5 Changed 11 years ago by dante

Milestone: 1.6future

comment:6 Changed 10 years ago by ben hockey

Keywords: needsreview added
Priority: highlow

comment:7 Changed 10 years ago by bill

Component: CoreEvents
Resolution: wontfix
Status: newclosed

dojo.connectPublisher() is in _base/connect.js, which implies that it's deprecated and will be removed in 2.0.

Note: See TracTickets for help on using tickets.