Skip to content

Instantly share code, notes, and snippets.

@asiletto
Last active January 4, 2016 08:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save asiletto/8599511 to your computer and use it in GitHub Desktop.
Save asiletto/8599511 to your computer and use it in GitHub Desktop.
function Clock(id) {
this.id = id;
this.init();
}
Clock.prototype = new EventEmitter();
Clock.prototype.init = function(){
var self = this;
self.on('tick', function(){
console.log('clock '+self.id+' emitted tick event at '+new Date());
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment