A simple PubSub implementation in JavaScript