Problem with no data in callback : how to pause load of a javascript function?

Yes, delete this: Change this: function setResult(data) { result = data; } to this: function setResult(data) { result = data; doCallback(); }.

Edit: setResult is happening multiple times and is asynchronous via iframe, and we don't know timing. Also callback only happens some of the time decided by another process. So we can not simply change the position of doCallback.

– Bin Shen Jul 28 at 0:57 @Bin Shen - won't some variation of my answer do the trick? – nnnnnn Jul 28 at 3:58.

A clunky solution (that doesn't involve my having to read your code carefully): var readyForCallback = false; function doMainProcess() { // your code here readyForCallback = true; } function doCallback(arg1,arg2,arg3,etc) { if (!readyForCallback) { // anonymous function as way to keep the original callback // argument(s) with a timeout setTimeout(function(){doCallback(arg1,arg2,arg3,etc);},20); return; } // your code here } Note: within your timeout function you could also use doCallback.apply() with the arguments object to automatically handle any number of arguments, but I didn't include this in my code because off-hand I forget whether you can just use the arguments object directly or if you'd have to first create a proper array populated from arguments.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions