49 lines
No EOL
1.2 KiB
JavaScript
49 lines
No EOL
1.2 KiB
JavaScript
|
|
|
|
// // 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');
|
|
} |