##// 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 385 tr[0].scrollIntoView();
386 386
387 $.Topic('/ui/plugins/code/anchor_focus').prepare({
387 $.Topic('/ui/plugins/code/anchor_focus').prepareOrPublish({
388 388 tr:tr,
389 389 remainder:remainder});
390 390 }
@@ -210,7 +210,7 b' var injectInlineForm = function(tr){'
210 210 }
211 211 }, 10);
212 212
213 $.Topic('/ui/plugins/code/comment_form_built').prepare({
213 $.Topic('/ui/plugins/code/comment_form_built').prepareOrPublish({
214 214 form:_form,
215 215 parent:_parent}
216 216 );
@@ -32,6 +32,14 b' jQuery.Topic = function (id) {'
32 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 43 processPrepared: function(){
36 44 var data = this.unhandledData;
37 45 this.unhandledData = [];
@@ -40,7 +48,8 b' jQuery.Topic = function (id) {'
40 48 }
41 49 },
42 50 subscribe: callbacks.add,
43 unsubscribe: callbacks.remove
51 unsubscribe: callbacks.remove,
52 callbacks: callbacks
44 53 };
45 54 if (id) {
46 55 topics[id] = topic;
@@ -10,5 +10,5 b' pyramid_registry = get_current_registry('
10 10 % endif
11 11 % endfor
12 12 <script>
13 $.Topic('/plugins/__REGISTER__').publish({});
13 $.Topic('/plugins/__REGISTER__').prepareOrPublish({});
14 14 </script>
General Comments 0
You need to be logged in to leave comments. Login now