mirror of
https://github.com/Threnklyn/MinecraftChat.git
synced 2026-06-07 05:33:32 +02:00
More performant way of defining event listeners
This commit is contained in:
@@ -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);
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user