I can't figure out why I can't make my server to run emit function.
Here's my code:
myServer.prototype = new events.EventEmitter;
function myServer(map, port, server) {
...
this.start = function () {
console.log("here");
this.server.listen(port, function () {
console.log(counterLock);
console.log("here-2");
this.emit('start');
this.isStarted = true;
});
}
listener HERE...
}
The listener is:
this.on('start',function(){
console.log("wtf");
});
All the console types is this:
here
here-2
Any idea why it wont print 'wtf'
?