Hacker News new | ask | show | jobs
by squeaky-clean 1115 days ago
It's basically a syntactic sugar on an Observer pattern but I like it. You would need a way to turn off 'when' observers. And I suppose it does couple the observer to the observable pretty tightly.
2 comments

Delete the observed variable?

About coupling, an implementation could send state change events to a message bus and observers could subscribe only the events they care about.

It's pretty easy to turn off the when observers, simply `delete when`.

Side-effect is that it will delete all the whens, so only use it if you need it!