Detect template change in Meteor -


i'm looking make element flash on screen when underlying collection updated.

it seems me make have equivalent of template.my_template.rendered = function(){} fired every time template updated.

ideally, function not fire first time template rendered.

this seems such obvious use case, missing something?

for meteor < 0.8

you should use template.mytemplate.created first time. docs template.mytemplate.rendered fired everytime there change including first time. if want limit second time , changes after (i'm guessing want), have write custom logic. there no meteor api supports that.


for meteor-0.8

it seems api underwent backwards incompatible changes in meteor-0.8.

there elegant way achieve described adaptation new meteor rendered callback here. bascially should modify whatever function attaching variables inside template's javascript calling helper function once. example,

var rendercount = 1;  var myhelper = function () {   console.log("rendered #" + rendercount);   rendercount++; };   template.mytemplate.myvariable = function () {   myhelper();   return this.name; }; 

hope helps. there alternative approach in same repo. might one.


Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

javascript - Using Windows Media Player as video fallback for video tag -

c# - Unity IoC Lifetime per HttpRequest for UserStore -