node.js style EventEmitter for client side