You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First thanks for your easy-to-use and beautiful VEX dialog, and now I'm using it in our project.
But I wonder if can I use it in a if statement like the traditional confirm() function in JavaScript, I want to send request only when user clicked YES/OK. I tried and failed.
Is there any method to achieve this task?
BR.
The text was updated successfully, but these errors were encountered:
The native confirm and prompt dialogs have a strange property in that they pause execution of all javascript on the page until they are responded to. That ability allows you to do something like:
value=confirm();
The javascript interpreter will pause on that line until the confirm dialog is submitted.
Vex, being made of just javascript, not the magic dust the browser is made of, cannot do that, so we have to use a callback:
vex.dialog.confirm({message: 'Are you absolutely sure you want to destroy the alien planet?',callback: function(value){returnconsole.log(value ? 'Successfully destroyed the planet.' : 'Chicken.');}});
Your callback function will be called with the response when the user has entered a value and clicked ok.
Ultimately, this is better, as we usually don't want to lock up the entire process while we're waiting for some input.
Hi
First thanks for your easy-to-use and beautiful VEX dialog, and now I'm using it in our project.
But I wonder if can I use it in a if statement like the traditional confirm() function in JavaScript, I want to send request only when user clicked YES/OK. I tried and failed.
Is there any method to achieve this task?
BR.
The text was updated successfully, but these errors were encountered: