Browser side you have some options (assuming client-side due to the jquery tag there)
First, You might be able to take advantage of setImmediate:
https://developer.mozilla.org/en-US/docs/Web/API/window.setImmediate
Second, you can use timers and split it up, a very simplistic example, then if you want to process more things, just stuff them into the thingstodoarray every now and then. Any one of a number of permuations on this.
int howoftentocheck = 60*1000; //60s
var thingstodoarray = [];
thingstodoarray.push("do this");
function checkForStuffToDo(){
if(thingstodoarray.length){
//.. do things be sure and pop or shift the thing you did.
}else{
setTimeout(function() { checkForStuffToDo() }, howoftentocheck)
}
}();
Third, instead of polling you can use events, so register events, say with jQuery or some other library that offers events, then you can fire them when you would like to do some processing, using .on and .trigger for example.
http://api.jquery.com/trigger/
I'm sure there are several other options, but the goal is to keep your event loop tight so that you don't take away from the user experience, etc.