I have code that looks like this:
function myEventHandler() {
inMyEventHandler = true;
longRunningStuff();
inMyEventHandler = false;
}
This works great, except on the iPad where Safari Mobile occasionally times out my Javascript with an error. So longRunningStuff() dies and inMyEventHandler never gets cleared. This is very bad, because inMyEventHander absolutely cannot be set if we're outside this function, or Bad Things(tm) happen.
Ideally, I could just check from deep within longRunningStuff whether myEventHandler is above it in the call stack, and this would take care of itself. I can't find a way to do that... Hints?