Skip to content

Instantly share code, notes, and snippets.

@CaptainYarb
Created February 9, 2014 04:15
Show Gist options
  • Save CaptainYarb/8894175 to your computer and use it in GitHub Desktop.
Save CaptainYarb/8894175 to your computer and use it in GitHub Desktop.
Node.js Module with Events Boilerplate
// setup event management
module.exports = function(){ return new Game(); }
var events = require('events'), util = require('util');
function Game(){ events.EventEmitter.call(this); }
util.inherits(Game, events.EventEmitter);
Game.prototype.start = function(){
// called when start is issued
this.emit('ready');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment