watchable computed states Β #221
Description
π Feature Request
Make computed states watchable.
β Is your feature request related to a problem?
It would be nice to react to changes on computed states.
π Describe the solution you'd like
Move the watch
and removeWatcher
methods from EnhancedState
class to the State
class. Additionally it would be nice to have a Watchable
interface which is implemented on State. Since this proposed change won't make Collections watchable, by implementing the Watchable
interface on the Collection
class you could make it watchable with a few changes in the future.
The watchable interface would be used where only the watch
and removeWatcher
methods are used. For example the useWatcher
react hook.
π Describe alternatives you've considered
Alternatively the Watchable
interface is not required, would just be nice to have.
β Additional Notes
I have the changes implemented in a fork already. If this feature request is accepted, I would follow up with a PR.