Skip to content

Instantly share code, notes, and snippets.

@tjunghans
Last active August 29, 2015 14:24
Show Gist options
  • Save tjunghans/11ec0959c69dee9636d4 to your computer and use it in GitHub Desktop.
Save tjunghans/11ec0959c69dee9636d4 to your computer and use it in GitHub Desktop.
Inherit from NodeJS Eventemitter
// EventEmitter pattern: https://www.joyent.com/developers/node/design#EventEmitter
var EventEmitter = require('events').EventEmitter;
var utils = require('utils');
function Controller() {
if (!(this instanceof Controller)) return new Controller();
EventEmitter.call(this);
}
utils.inherits(Controller, EventEmitter);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment