I have created a custom confirm function which creates a bootstrap confirmation box.
There is a third party javascript library, which has an event if we return true in that event means the further process will run else return false will not run the execution.
If I use javascript confirm function it waits for user confirmation (Expected behaviour). see code below:
variable.attachEvent("onSomeEvent", function (e){
let r = confirm("Do you want to proceed?");
if(r){
return true;
}else{
return false;
}
});
If I use my custom confirm it does not wait for user confirmation. see code below:
variable.attachEvent("onSomeEvent", function (e){
customConfirm("Do you want to proceed?", callback(choice){
return choice == "Yes";// I know this return is for callback function not of event.
});
});
I tried using async and await but didn’t work, might be I am doing something wrong.
9