Non riesco a capire perché non riesco a far funzionare la mia funzione di emettere il mio server.Utilizzo della funzione emit in node.js
Ecco il mio codice:
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...
}
L'ascoltatore è:
this.on('start',function(){
console.log("wtf");
});
Tutti i tipi di console è questo:
here
here-2
Qualsiasi idea del perché non ci vorrà stampare 'wtf'
?
Grazie mille!!! – Itzik984