Cannot get Tracker.Dependency to work - what am I missing? [SOLVED]

Hi,

I’m trying to get a template.helper to fire when object in an array change, but I am not getting anywhere. I tried with the Reactive Array package, but that only fires when you add or remove elements from the array, so that did not work.

Now I am trying with Tracker.Dependency, but I cannot get the helper to rerun whenever I want. I have this structure for the Dependency:

> Template.frontend.created = () ->
>     testDep = new Tracker.Dependency

> 'click .question': (event, template) ->
>     # some code :-)
>     Template.instance().arrQsDep.changed

> Template.frontend.helpers
>     getQuestionsLevel: ->
>         console.log 'I fire only once!'
>         Template.instance().arrQsDep.depend
>         return arrQ

I get no error-messages, but the frontend.helper fires only once… where am I going wrong? :smile:
I’ve read all the docs I could find, and as I understand it, it should fire…

regards,

Paul

You had too much coffee I think :smiley:
depend()
not depend and same with changed

OMG…TNX!!!

sometimes you can look over the most stupid mistakes… :blush:

Yes, people must find the hard way to not push coffeescript too much :smiley:
But my usual non working helper also usualy seem like this

getSomething: ->
  Template.instance().something.get  

and use the return keyword if it is not just 1 line function/helper etc.
It can become criptic without it sometimes as code evolve.

Yeah, it might be nice if the interpreter would flag if you access a function as a property or the other way around… :smile: That should be possible, you would think… anyway, I can continue with my project. Once again: thank you!!