Adding a small Javascript event emitter.