Is there a way to pass an arrow function as a variable in a tab?
I am working with a function that looks like this:
public handleLogin(data) {
this.socket.send(data);
[...]
}
This function is located within a functions tab:
let tab = [this.handleLogin];
tab[0](data);
However, when I call handleLogin through the tab, my socket attribute is undefined. It seems like 'this' does not refer to my class instance but to the function instance, so it may not be an arrow function.
What would be the correct syntax for this scenario?