Is there a way to pause a function once inside it. Not uding the setTimeout(); function but once the function is called pause it for a half second or so. Example I want this function to pause for 1/2 second if the OS is Mac. Any thoughts?
@toicontienDec 04.2006 — #You can use an alert box. But that's about it. Otherwise, you're stuck with setTimeout. <i> </i>var resumeFunc = function() { pauseOnMacOS(true); }
function pauseOnMacOS(skipPause) { var myNum = 3; if (!skipPause && IS_MAC_OS) { setTimeout(resumeFunc, 500); } else { alert(myNum); } }
I'm assuming the IS_MAC_OS variable is global and is set to true before the pauseOnMacOS() function is called.
You are corect in the fact that the is mac is already set. I will try it your way. I will try and call a function similar to yours and then return true which allows the current function to continue. Thanks for the help. I did not think of doing it that way.. Thanks again.