
Many workarounds are there to try to implement such functions. This function performBatchActions, when called, simply executes the performAPIRequest function, waits about 5 seconds, and then calls the same function again. I understand that using setTimeout() involves more thought than a desirable sleep() function, but unfortunately the later doesn't exist. Var y = null // To keep under proper scope

You use setTimeout() to rewrite it this way: var x = 1 Place mysterious code that blocks the thread for 100 ms. delay () method is best for delaying between queued jQuery effects. It's not that hard to use actually, instead of writing this: var x = 1 1 ( 'foo' ).slideUp ( 300 ).delay ( 800 ).fadeIn ( 400 ) When this statement is executed, the element slides up for 300 milliseconds and then pauses for 800 milliseconds before fading in for 400 milliseconds. Unfortunately, setTimeout() is the only reliable way (not the only way, but the only reliable way) to pause the execution of the script without blocking the UI.
