Mini-module implementation of node.js events module