Closed rodydavis closed 4 years ago
It adds additional cost(mainly memory). How about implement as a mixin?
It can have a max set on the tracked changes. And not sure if it can be a mixin as I need to intercept the setter on value
I added 0 to the tracked changes by default. This means that it will have not memory impact. By adding -1 to maxTrackedChanges
it will have an unbounded history and a number greater than 0 will remove the oldest change from the stack when it reaches the max.
We'll want some tests for that + documentation
Also, if not for a mix-in, we can have a different base class. Like UndoableStateNotifier
.
What about TrackedStateNotifier
? I can create a new base class and write some tests