From 3a22acf5100302af807e22518da45486ca386620 Mon Sep 17 00:00:00 2001 From: Jonas Weinz Date: Sun, 24 Mar 2019 18:55:06 +0100 Subject: [PATCH] fixes again --- websocket_connection.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/websocket_connection.js b/websocket_connection.js index 6c8716b..c65e873 100644 --- a/websocket_connection.js +++ b/websocket_connection.js @@ -293,19 +293,27 @@ class WebsocketConnection for (i = 0; i < n; 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", () => { - this.send_unfriend_request("" +this.friends[i]); + tmp[2].addEventListener("click", function (){ + this.connection.send_unfriend_request(this.name); }); this.friend_name_divs.push(tmp[0]) } } + + connect(username, pw) { this.socket = new WebSocket(server_protocol + this.ip + ":" + this.port);