Search code examples
htmltypescriptaurelia

Detecting variable changes with Aurelia


Can i detect changes to a variable with aurelia?

I am able to detect the change of a type with @observable, but I am innterested in the change in a variables value ex a = 3 to a = 4 -> detect and do magic()


Solution

  • Normaly you can. https://discourse.aurelia.io/t/how-to-observe-objects-in-aurelia-using-the-binding-engine/23

    "The propertyObserver doesn’t really have many caveats, the only thing you need to be aware of is you can only watch a single property. You can create multiple propertyObserver calls to observe multiple properties, but you cannot observe objects as a whole (as there are no native events fired when they change)"