Long story short, is it possible to do something like this without a callback function?
function foo(){
return 'foo';
}
function bar(){
x = setTimeout(foo, 2000);
alert(x);
}
Without modifying the foo() function. Adding an intermediary function would be fine, but I don't think that'll accomplish anything.
Long story: I'm looking to simulate window.showModalDialog via window.open without having to do significant code rewrites everywhere the dang thing was used. The only suggestions I have found are to use a while loop or ping the server to simulate sleep(). Neither solution strikes me as ideal, and I am wondering if there is any other way to do something like this minus the callback function method?
Short answer: No.
I would answer in more detail, but since you asked for a "short" answer and ruled another "callback" out", there is only this left to say.
setTimeout will always return an identifier to clear the timeout and anything you return from the function you pass into setTimeout is getting ignored.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With