fixes again

This commit is contained in:
Jonas Weinz 2019-03-24 18:55:06 +01:00
parent 80b8ff8f93
commit 3a22acf510

View File

@ -293,19 +293,27 @@ class WebsocketConnection
for (i = 0; i < n; i++) for (i = 0; i < n; i++)
{ {
var tmp = this.search_container.create_double_button("" + this.friends[i], "-"); var tmp = this.search_container.create_double_button("" + this.friends[i], "-");
tmp[1].name = this.friends[i];
tmp[2].name = this.friends[i];
tmp[1].connection = this;
tmp[2].connection = this;
tmp[1].addEventListener("click", () => {
this.send_match_request("" +this.friends[i]); tmp[1].addEventListener("click", function() {
this.connection.send_match_request(this.name);
}); });
tmp[2].addEventListener("click", () => { tmp[2].addEventListener("click", function (){
this.send_unfriend_request("" +this.friends[i]); this.connection.send_unfriend_request(this.name);
}); });
this.friend_name_divs.push(tmp[0]) this.friend_name_divs.push(tmp[0])
} }
} }
connect(username, pw) connect(username, pw)
{ {
this.socket = new WebSocket(server_protocol + this.ip + ":" + this.port); this.socket = new WebSocket(server_protocol + this.ip + ":" + this.port);