Added comments and readme

This commit is contained in:
Julian Appel 2026-04-10 22:16:51 +02:00
parent 1d632252bf
commit e25c8606d9
8 changed files with 252 additions and 16 deletions

View file

@ -1,13 +1,23 @@
// CLI-Controller (Testdatei)
// Zuständig für die Verarbeitung von Kommandozeilen-Befehlen des Scoreboards.
// Aktuell nur ein Funktionstest mit einem einfachen `ls`-Befehl.
const exec = require('node:child_process');
// run the `ls` command using exec
// Testaufruf: Listet den Inhalt des aktuellen Verzeichnisses auf,
// um zu prüfen, ob child_process.exec korrekt funktioniert.
exec('ls ./', (err, output) => {
// once the command has completed, the callback function is called
if (err) {
// log and return if we encounter an error
console.error("could not execute command: ", err)
return
}
// log the output received from the command
console.log("Output: \n", output)
})
})

View file

@ -15,7 +15,7 @@ let teamB = {
};
let sideswitch = false;
// Function prototypes
// Funktionsübersicht (Prototypen ohne Implementierung — nur zur Übersicht)
function setEnabled(status) {};
function configTeam(team, name, name2, isSpielgemeinschaft) {};
function setScore(team, score) {};
@ -30,6 +30,7 @@ function setEnabled(status) {
enabled = status;
}
// Setzt Namen und Spielgemeinschafts-Status eines Teams
function configTeam(team, name, name2, isSpielgemeinschaft) {
if(team == "teamA") {
teamA.name = name;
@ -51,7 +52,7 @@ function setScore(team, score) {
}
}
// Increment score by one
// Ändert den Score eines Teams um 1 — Richtung "inc" (erhöhen) oder "dec" (verringern)
function alterScore(team, dir) {
if(team == "teamA") {
if(dir == "inc") {

View file

@ -1,7 +1,12 @@
// Erstellt den zentralen Socket.IO-Server auf Port 3001.
// Wird von timer.js, score.js und den Routen importiert,
// um Events (Timer, Score, Refresh) an alle verbundenen Clients zu senden.
const { Server } = require('socket.io');
// CORS auf "*" gesetzt, da Admin und Monitor auf unterschiedlichen Ports laufen können
const io = new Server(3001, {
cors: { origin: "*" }
});
});
module.exports = io