Trying to create the observer pattern in Javascript to use in the browser.