i am working with javascript and i was wondering if there is an event listener for passing time, e.g. a timer. I currently have an event listener in place for a mouse click, but i would like to remove the ability for GUI to control when the event happens.
I have this code right now for the event listener.
function doubleClick(e) {
for (var i = gravities.length - 1; i >= 0; i--) {
if (gravities[i].isMouseOver) {
gravities[i].collapse();
break;
}
}
}
I am relatively new at javascript, and don’t know how to make another line of code that would execute the function, but on a timed schedule i.e. every 30 seconds as opposed to on user input.