mirror of
https://github.com/Threnklyn/MinecraftChat.git
synced 2026-06-05 20:59:03 +02:00
More performant way of defining event listeners
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
module.exports = (socket) => {
|
||||
|
||||
socket.mcbot.on('error', (error) => {
|
||||
function onError(error) {
|
||||
|
||||
// this is okay because the connection was ended
|
||||
if (error.toString() === 'Error: write after end') return;
|
||||
@@ -14,6 +14,8 @@ module.exports = (socket) => {
|
||||
// delete the bot
|
||||
delete socket.mcbot;
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
socket.mcbot.on('error', onError);
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user