How to watch and catch a reactive variable for changes


I have a helper {{ allusers }} which i am using to list all users fetched from my mini mongo. Since allusers helper is reactive, is there a way i can watch and catch allusers so as i can get notified via an event everytime allusers has changed,whether new data was added,data was edited or data was deleted?.


Found it

        var text = Math.random();
        Session.set("text", text);

        this.sessionWatcher ='text', function(value) {
        alert('The value of "text" changed! It is now: ' + value);

and this package


Normally you would do that with Working with a Session variable like that looks like a workaround.

What is the exact action you want to take when something changes? Is it rendering some template or is it running some custom code?


I’m with @lucfranken on this. That package is just a thin wrapper around Tracker.autorun and you would normally examine your use case for where you are wanting to track reactive data changes and use the appropriate construct (helpers, template autoruns, Tracker autoruns, etc).