We can define a function to perform everytime an attribute’s value gets changed by using this.on("attr:someAttrName"), function(value, prev) { ...});
But I want to do this for a variable that belongs to the script. By that I mean, I created the variable using this.someVar
. How do I define a function to trigger whenever a variable’s value changes?