Cleanup clientonly jsdoc

This commit is contained in:
rejas 2020-07-29 22:13:19 +02:00
parent 2d5a19b676
commit eee64c8064

View File

@ -9,11 +9,13 @@
*/ */
function getServerAddress() { function getServerAddress() {
/** /**
* Helper function to get command line parameters * Get command line parameters
* Assumes that a cmdline parameter is defined with `--key [value]` * Assumes that a cmdline parameter is defined with `--key [value]`
* *
* @param key * @param {string} key key to look for at the command line
* @param defaultValue * @param {string} defaultValue value if no key is given at the command line
*
* @returns {string} the value of the parameter
*/ */
function getCommandLineParameter(key, defaultValue = undefined) { function getCommandLineParameter(key, defaultValue = undefined) {
var index = process.argv.indexOf(`--${key}`); var index = process.argv.indexOf(`--${key}`);
@ -31,12 +33,15 @@
} }
/** /**
* @param url * Gets the config from the specified server url
*
* @param {string} url location where the server is running
* @returns {Promise} the config
*/ */
function getServerConfig(url) { function getServerConfig(url) {
// Return new pending promise // Return new pending promise
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// Select http or https module, depending on reqested url // Select http or https module, depending on requested url
const lib = url.startsWith("https") ? require("https") : require("http"); const lib = url.startsWith("https") ? require("https") : require("http");
const request = lib.get(url, (response) => { const request = lib.get(url, (response) => {
var configData = ""; var configData = "";
@ -58,8 +63,10 @@
} }
/** /**
* @param message * Print a message to the console in case of errors
* @param code *
* @param {string} [message] error message to print
* @param {number} code error code for the exit call
*/ */
function fail(message, code = 1) { function fail(message, code = 1) {
if (message !== undefined && typeof message === "string") { if (message !== undefined && typeof message === "string") {