Hi team,
I read some time ago that major browsers are looking to remove thread blocking prompts in the future
alert(), confirm(), etc
So to future-proof the app i’m working on, i made a quick little ConfirmPrompt class with callback functions for confirm & cancel aswell as a simple queue system for multiple prompts since it’s no longer blocking.
Useage
// Initiate the class
let confirmPrompt = new ConfirmPrompt(advancedTexture);
// Create a prompt
confirmPrompt.check( text, onConfirm, onCancel);
e.g:
confirmPrompt.check(
"Are you sure?",
function(){
//onConfirm
},
function(){
//onCancel
}
);
Feel free to use it however you see fit