Hello!
I have a setInterval timer I need to run on 1 page in the app only. I’ve created a JavaScript Function which starts the timer, and my if/else statement provides the correct console logs (“Starting!”, “Stopping!”), but the timer does not stop. Below is my Javascript Function. Please help!
Thanks,
Randy
———
function startTimer() {
var thisP = localStorage.getItem('thisPage');
console.log(thisP, "thisP");
var pageReload = setInterval("getNowPlaying.execute({})", 10000);
if (thisP === '1')
{
setInterval(pageReload, 10000);
console.log("Starting!");
} else {
console.log("Stopping!");
clearInterval(pageReload);
}
}