Event-Based Programming is natural to any GUI based interface. HTML DOM offers inbuilt Event Notification model, but it is only useful when you are dealing with DOM Elements. There is no support for non-DOM elements.
This article showcases building up custom event publisher-subscriber model on top of Reactive Programming for non-DOM elements.
Consider modelling Thermostat, when room temperature crosses a certain threshold (30°C), AC would turn up, and windows would close.
Consider class Thermostat which encapsulates the logic of monitoring and publishes events:
above: when temperature crossed above 30°C (threshold) from lower value.
below: when temperature crossed below or equal to 30°C (threshold) from higher value.