More performant way of defining event listeners

This commit is contained in:
AlexKvazos
2015-05-01 12:11:02 -05:00
parent 6ee4de3920
commit 39531b1f99
9 changed files with 36 additions and 26 deletions
+4 -2
View File
@@ -3,7 +3,7 @@ import events from '../../bot';
module.exports = (socket) => {
socket.on('server:connect', (data) => {
function onConnection(data) {
// log activity to console
console.log(`connecting > ${data.hostname}:${data.port} - ${data.username}`);
@@ -36,6 +36,8 @@ module.exports = (socket) => {
// bind bot events
events(socket);
});
}
socket.on('server:connect', onConnection);
};