Created
February 9, 2014 04:15
-
-
Save CaptainYarb/8894175 to your computer and use it in GitHub Desktop.
Node.js Module with Events Boilerplate
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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