Add debug stats and event emitter.

This commit adds debug and rendering stats to the page. It also
adds the EventEmitter library in order to support future event-
driven features.