Detecting value change with ViewModel

Hi there, just wondering if there is a specific way of detecting when a certain piece of data changes in ViewModel? I thought I saw some mention of a changed attribute/function at some point?

My use case is trying to change a value of a variable inside an autorun block (unless it was that particular variable that has just been updated)

Are you using Blaze,

We are handling any changes in the collection using this

 Collection.find({ user: "id"},{sort: {last_msg_time: -1}})
               added: function(newDoc) {
              removed: function(oldDoc) {
              changed: function(newDoc, oldDoc) {       

If you are using blaze, I would like to know how you are using viewmodal

This is typically a code smell. But if you really must, and sometimes you do, any reactive data source inside the autorun will trigger the autorun to compute, along with the rest of the code you put there.

const myVar = new ReactiveVar();

instance.autorun(() => {
   console.log('myVar changed', myVar.get();

myVar.set('foo'); // <-- this will trigger the autorun to run