I think I’ve been suffering from a very strange bug. There might be something systematically broken with EventEmitter. Ever since I started using the once function things seem off.
The following lines of console output demonstrate what’s happening:
var EventEmitter = require('events').EventEmitter;
a = new EventEmitter();
a.on("bla", function() { console.log("perm");});
a.once("bla", function() { console.log("this is temp"); });
a.emit('bla');
You would expect both events to be called, but on my console the output is:
> a.emit("bla")
perm
perm
true
What’s going on??
I’ve also tried using the code in a script and that seemed to work but I’m getting the feeling that the once function is somehow responsible for the weird glitches on my server.
Anyone ever encountered this?
[Tested on versions 0.5.1 and 0.5.3]
Works for me on 0.5.10. I’m pretty sure you typed something else than what you posted here – where could the second “perm” come from? Try it again.