Add JSDoc comments

This commit is contained in:
Cohee 2024-04-13 21:51:36 +03:00
parent f0bce909f6
commit ef917ebe4e
1 changed files with 15 additions and 10 deletions

View File

@ -498,15 +498,14 @@ const setupTasks = async function () {
await statsEndpoint.init();
const cleanupPlugins = await loadPlugins();
const BackUpTitle = process.title;
const consoleTitle = process.title;
const exitProcess = async () => {
statsEndpoint.onExit();
if (typeof cleanupPlugins === 'function') {
await cleanupPlugins();
}
setWindowTitle(BackUpTitle);
setWindowTitle(consoleTitle);
process.exit();
};
@ -566,6 +565,19 @@ if (listen && !getConfigValue('whitelistMode', true) && !basicAuthMode) {
}
}
/**
* Set the title of the terminal window
* @param {string} title Desired title for the window
*/
function setWindowTitle(title) {
if (process.platform === 'win32') {
process.title = title;
}
else {
process.stdout.write(`\x1b]2;${title}\x1b\x5c`);
}
}
if (cliArguments.ssl) {
https.createServer(
{
@ -592,10 +604,3 @@ function ensurePublicDirectoriesExist() {
}
}
}
function setWindowTitle(title) {
if (process.platform == 'win32')
process.title = title
else
process.stdout.write('\x1b]2;' + title + '\x1b\x5c')
}