Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 138163

Is there any way to only trigger function once inside of setInterval? [closed]

$
0
0

I have a array with schedule of times. And my goal is to compare the current time to the times inside of the array. Im using setInterval to update the time and to check if the current time is matching the times inside of the array. If they match i want to trigger a function that starts a timer.

My problem is that if i have it inside the setInterval the function keeps trigger for the whole minute, but i can´t have anything outside of setInterval because a need to check and compare at all times. I use vanilla javascript.

Hope anyone can help.


Viewing all articles
Browse latest Browse all 138163

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>