I created this class User:
class User {
constructor(socket) {
this.socket = socket;
this.socket.on('disconnect', this.onDisconnect);
this.room = 'test';
}
onDisconnect () {
console.log('socket disconnected');
console.log(this);
}
}
It has a method onDisconnect and a property room.
In the onDisconnect method this
is the socket object. How can I reference other class properties? Specifically this.room