Skip to content

Instantly share code, notes, and snippets.

@elarkin
Created November 28, 2010 18:24
Show Gist options
  • Save elarkin/719156 to your computer and use it in GitHub Desktop.
Save elarkin/719156 to your computer and use it in GitHub Desktop.
Proves that eventemitter.emit works as expected.
var sys = require('sys')
var EventEmitter = require('events').EventEmitter
var func = function(arg1, arg2) {
if(arg1 === undefined && arg2 === undefined) {
sys.puts("I was called without parameters");
}
};
var emitter = new EventEmitter();
emitter.on('test',func)
func();
emitter.emit('test');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment