summaryrefslogtreecommitdiff
path: root/WebInterface/NodeJSServer/src/modules/server-client.js
diff options
context:
space:
mode:
authorTrueKuehli <rctcoaster2000@hotmail.de>2018-10-01 18:10:37 +0200
committerTrueKuehli <rctcoaster2000@hotmail.de>2018-10-01 18:10:37 +0200
commit6f162dcf90a6aa671eb351dc25cb01e2d9cbd3cb (patch)
treece9121463419cb27e6bd4e0c4215c037550f8ff7 /WebInterface/NodeJSServer/src/modules/server-client.js
parente463bf3eb7115f1f141da2162b0624f90472ff9c (diff)
A lot of changes
I shoud have written a better commit, I know!
Diffstat (limited to 'WebInterface/NodeJSServer/src/modules/server-client.js')
-rw-r--r--WebInterface/NodeJSServer/src/modules/server-client.js16
1 files changed, 10 insertions, 6 deletions
diff --git a/WebInterface/NodeJSServer/src/modules/server-client.js b/WebInterface/NodeJSServer/src/modules/server-client.js
index ea37e1e..1bc9822 100644
--- a/WebInterface/NodeJSServer/src/modules/server-client.js
+++ b/WebInterface/NodeJSServer/src/modules/server-client.js
@@ -10,9 +10,12 @@ export default class ServerClient {
* @param {string} url URL of server running signalR
* @param {string} serverListingId HTML ID of server-listing element,
* to populate with available games
+ * @param {BannerController} notifications Notification Manager
+ * @param {array} ui UI Elements to reload on login
* @param {boolean} [debug=false] Enable debug output?
*/
- constructor(url, serverListingId, debug = false) {
+ constructor(url, serverListingId, notifications, ui, debug = false) {
+ this.ui = ui;
const connectionBuilder = new signalR.HubConnectionBuilder()
.withUrl(url);
@@ -30,7 +33,7 @@ export default class ServerClient {
// Initialize refreshing (blocks new refreshes if true)
this.refreshing = false;
- this.serverListing = new ServerListing(serverListingId);
+ this.serverListing = new ServerListing(serverListingId, notifications);
this.messageHandling();
}
@@ -44,7 +47,7 @@ export default class ServerClient {
this.connection.on('ListGroups', (groups) => {
// Populate server listing
this.serverListing.flushElements();
- this.serverListing.addElements(groups);
+ this.serverListing.addElements(groups, this, this.ui);
this.connection.off('ListGroups');
this.refreshing = false;
@@ -76,7 +79,7 @@ export default class ServerClient {
*/
sendLogin(group, password, username, callback) {
this.connection.on('LoginResponse', (result) => {
- callback(result);
+ callback(result, this);
this.connection.off('LoginResponse');
});
this.connection.invoke('Login', group, username, password);
@@ -99,6 +102,7 @@ export default class ServerClient {
/**
* Callback to call with response to login request
* @callback ServerClient~loginCallback
- * @param {number} result 0: Success, 1: PasswordError, 2:UsernameTaken
- * , 3:Unknown Error
+ * @param {number} result 0: Success, 1: PasswordError, 2:UsernameTaken,
+ * 3:Unknown Error
+ * @param {ServerClient} client ServerClient object, that handled the login
*/