game: add: docstring

This commit is contained in:
2024-01-22 13:21:51 +01:00
parent ab73826c11
commit 6fd11d0028
10 changed files with 231 additions and 12 deletions

View File

@ -13,7 +13,14 @@ class MatchMaking
this.client = client
this.searching = false;
}
/**
*
* @param {CallableFunction} receive_func
* @param {CallableFunction} disconnect_func
* @param {Number} mode The number of players in a game
* @returns {undefined}
*/
async start(receive_func, disconnect_func, mode)
{
if (!await this.client.isAuthentificate())
@ -36,6 +43,7 @@ class MatchMaking
this._socket.onclose = this.onclose.bind(this);
}
onclose(event)
{
this.stop();
@ -44,8 +52,10 @@ class MatchMaking
async stop()
{
if (this._socket)
this._socket.close()
this._socket = undefined
this.searching = false;
this._socket.close()
}
}