##// END OF EJS Templates
topics: improve handling topics without callbacks subscribed
ergo -
r451:5a3151b8 default
parent child Browse files
Show More
@@ -384,7 +384,7 b' function offsetScroll(element, offset){'
384
384
385 tr[0].scrollIntoView();
385 tr[0].scrollIntoView();
386
386
387 $.Topic('/ui/plugins/code/anchor_focus').prepare({
387 $.Topic('/ui/plugins/code/anchor_focus').prepareOrPublish({
388 tr:tr,
388 tr:tr,
389 remainder:remainder});
389 remainder:remainder});
390 }
390 }
@@ -210,7 +210,7 b' var injectInlineForm = function(tr){'
210 }
210 }
211 }, 10);
211 }, 10);
212
212
213 $.Topic('/ui/plugins/code/comment_form_built').prepare({
213 $.Topic('/ui/plugins/code/comment_form_built').prepareOrPublish({
214 form:_form,
214 form:_form,
215 parent:_parent}
215 parent:_parent}
216 );
216 );
@@ -32,6 +32,14 b' jQuery.Topic = function (id) {'
32 this.unhandledData.push(arguments[i]);
32 this.unhandledData.push(arguments[i]);
33 }
33 }
34 },
34 },
35 prepareOrPublish: function(){
36 if (callbacks.has() === true){
37 this.publish.apply(this, arguments);
38 }
39 else{
40 this.prepare.apply(this, arguments);
41 }
42 },
35 processPrepared: function(){
43 processPrepared: function(){
36 var data = this.unhandledData;
44 var data = this.unhandledData;
37 this.unhandledData = [];
45 this.unhandledData = [];
@@ -40,7 +48,8 b' jQuery.Topic = function (id) {'
40 }
48 }
41 },
49 },
42 subscribe: callbacks.add,
50 subscribe: callbacks.add,
43 unsubscribe: callbacks.remove
51 unsubscribe: callbacks.remove,
52 callbacks: callbacks
44 };
53 };
45 if (id) {
54 if (id) {
46 topics[id] = topic;
55 topics[id] = topic;
@@ -10,5 +10,5 b' pyramid_registry = get_current_registry('
10 % endif
10 % endif
11 % endfor
11 % endfor
12 <script>
12 <script>
13 $.Topic('/plugins/__REGISTER__').publish({});
13 $.Topic('/plugins/__REGISTER__').prepareOrPublish({});
14 </script>
14 </script>
General Comments 0
You need to be logged in to leave comments. Login now