Closed denis44 closed 11 years ago
Unfortunately JavaScript is a non-blocking language and this is not possible. You'd have to adjust the code to use the callback.
alertify.confirm( 'question', function ( e ) {
if ( e ) {
// the code to execute after a user choice
}
});
Closing - if you have more questions/comments, feel free to reopen.
In my program I need to block the program flow until user make a choise.
function api_call_from_external_library(e) {
if(confirm("Do you really want to delete it?")) { return true; }
// the code here should be executed only after user made a choise, // not immediately
return false; });
If I use alertify just as described on the website, the dialog runs in background and the next statement will be executed. But I need block the workflow in this function until I have input from user. How can I do it?
PS I know it's better to run it in background, but in this case my function is called from external API and when I leave this function, I have to return a specific value. But I cannot return it until I have user input...