When changing a property on a class instance from within a method in that class, the callback is called with an empty path instead of the property that was changed.
import onChange from 'on-change';
class Foo {
constructor() {
this.bar = true;
}
toggle() {
this.bar = !this.bar;
}
}
let foo = onChange(
new Foo(),
(path) => console.log(path),
{ pathAsArray: true },
);
foo.toggle();
// Output: [] β
// Expected: ['bar']
foo.bar = !foo.bar;
// Output: ['bar'] βοΈ
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too