javascript - Meteor callback on some template render -


in meteor project, have code this:

baz = function() {     // jquery add/remove class here... };  template.foo.onrendered(function() {     baz(); });  template.bar.onrendered(function() {     baz(); });  template.qux.onrendered(function() {     // no baz() call }); 

is there better way accomplish task without repeat baz(); on template render?

meteor 1.2.1 allows run global onrendered() function via following code:

template.onrendered(function() {     var = this; //pass baz() if need     deps.afterflush(function() {         console.log('baz');         baz();     }); }); 

if doesn't fit needs, , want on every page, use onrendered() within common template menu or page header, not guarantee html attempting alter jquery rendered.


Comments

Popular posts from this blog

ios - UITEXTFIELD InputView Uipicker not working in swift -

Hatching array of circles in AutoCAD using c# -