Javascript: Return value for asynchronous onload events synchronously?

There are ways of making this work, by blocking the function until the image has loaded but its a bad thing to do. The calling code should pass in a callback function, or two if you want an error callback a well.

There are ways of making this work, by blocking the function until the image has loaded but its a bad thing to do. The calling code should pass in a callback function, or two if you want an error callback a well. Check_min_sizing(input, options, function(e){ // do something successful }, function(error){ // throw an error }).

It's downright *evil*. Fru-ets of the dev-eel.It should never be thought about... ever. (Oh, BTW, the accepted answer is going to be a variant of this one so +1).

– cwallenpoole Jul 7 at 5:20 So... would the non-evil thing to do be to use a callback function, then? – neezer Jul 7 at 13:33 Yes callbacks are simple. If you want to get fancy do some research on 'promises' in javascript.

– Brendan wood Jul 9 at 7:21.

In asynchronous model, AMAIK there is no way to wait for callback and I think your request (architecture) is wrong basically. Whatever you want to do based on true or false result, should happen in your callback function.

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