Added comments, incDec function

This commit is contained in:
2024-05-17 21:17:52 +02:00
parent 9f845ea234
commit 35a0785bf3
3 changed files with 39 additions and 5 deletions
+15 -1
View File
@@ -50,6 +50,7 @@ async function timerStart() {
}
}
// Request to pause the timer
async function timerPause() {
const response = await fetch("/admin/timerPause"); // Call API Endpoint /admin/timerStart
if(response.status == 200) {
@@ -63,6 +64,7 @@ async function timerPause() {
}
}
// Request to reset the timer with the specified time
async function timerReset() {
let newDuration = document.getElementById("timerSelectDuration").value;
const response = await fetch("/admin/timerReset", { // Call API Endpoint /admin/timerStart with selected new duration in seconds
@@ -72,7 +74,19 @@ async function timerReset() {
});
const data = await response.json(); // Wait for asyncronous transfer to complete and parse json (which got received by backend)
console.log(data); // Print received data
updateFrontend(data); // Update admin frontend with received values
updateTimerFrontend(data); // Update admin frontend with received values
}
// Request to increase or decrease the timer depending on passed value in seconds
async function timerIncDec(value) {
const response = await fetch("/admin/timerIncDec", { // Call API Endpoint /admin/timerIncDec with value in seconds to increase or decrease the timer
method: 'POST',
headers: { "Content-Type": "application/json" },
body: JSON.stringify({value: value})
});
const data = await response.json(); // Wait for asyncronous transfer to complete and parse json (which got received by backend)
console.log(data); // Print received data
updateTimerFrontend(data); // Update admin frontend with received values
}
// Scoreboardfunctions