Implementations of the Observer pattern in JavaScript