the instance which property.
the name of the changed property.
import {declare, notifyChange} from "apprt-core/Mutable";
let globalCounter = 0;
const Clazz = declare({
counter: {
get() {
return globalCounter;
}
}
});
const instance = new Clazz();
instance.watch("counter", ({ value }) => {
console.log(`count: ${value}`);
});
// ensure that external counter can be watched
globalCounter++;
notifyChange(instance, "counter");
//-> count: 1
Helper to trigger custom change notification.