Pl4tform_website/includes/nowLive.js

49 lines
1.2 KiB
JavaScript
Raw Normal View History

2025-02-03 19:29:59 +01:00
// // Funktion, die die Div alle 5 Sekunden aktualisiert
// function nowLive(){
// $("#actualPlaying").load("includes/nowLive.php");
// console.log('Nowlive updated');
// }
// // Intervall starten
// function startLiveUpdate() {
// liveInterval = setInterval(nowLive, 5000); // Intervall alle 5 Sekunden
// console.log('Live updates started');
// }
// // Intervall stoppen
// function stopLiveUpdate() {
// clearInterval(liveInterval); // Stoppt das Intervall
// console.log('Live updates stopped');
// }
let isUpdating = false;
function nowLive() {
if (isUpdating = false) {
console.log('doesnt update beaucause isUpdating = '+isUpdating)
return;} // Verhindert gleichzeitige Updates
isUpdating = true;
$("#actualPlaying").load("includes/nowLive.php", function() {
isUpdating = false; // Update abgeschlossen
});
console.log('Nowlive updated');
}
function startLiveUpdate() {
isUpdating = true;
nowLive();
liveInterval = setInterval(nowLive, 5000);
console.log('Live updates started');
}
function stopLiveUpdate() {
isUpdating = false;
clearInterval(liveInterval);
console.log('Live updates stopped');
}