Created
November 28, 2010 18:24
-
-
Save elarkin/719156 to your computer and use it in GitHub Desktop.
Proves that eventemitter.emit works as expected.
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
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