Skip to content

Instantly share code, notes, and snippets.

@nltncsr
Created February 19, 2017 05:00
Show Gist options
  • Save nltncsr/095aa33c4707d91c34b48735520e4203 to your computer and use it in GitHub Desktop.
Save nltncsr/095aa33c4707d91c34b48735520e4203 to your computer and use it in GitHub Desktop.
function EventEmitter() {
this.events = {};
var instance = this;
this.on = function(e, callback) {
instance.events[e] = callback;
};
this.emit = function(e) {
var args = Array.prototype.slice.call(arguments, 1);
instance.events[e](args);
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment