Skip to content

Instantly share code, notes, and snippets.

@jimfleming
Created January 7, 2011 07:25
Show Gist options
  • Save jimfleming/769223 to your computer and use it in GitHub Desktop.
Save jimfleming/769223 to your computer and use it in GitHub Desktop.
Should emit events.
var sys = require('sys'),
events = require('events');
var Emission = module.exports = function () {
events.EventEmitter.call(this);
this.cycles = 0;
};
sys.inherits(Emission, events.EventEmitter);
Emission.prototype.cycle = function () {
this.emit('recycle', ++this.cycles);
var self = this;
setInterval(function() {
self.cycle();
}, 0);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment