Ya got it.... so I can do something like this
function WaitForEventInModal() {
return new Promise(function(resolve, reject) {
// only `delay` is able to resolve or reject the promise
$(MyModal).on('click',MyModal,function(){})
});
}
function WaitForEventInModal() {
return new Promise(function(resolve, reject) {
// only `delay` is able to resolve or reject the promise
$(MyModal).on('click',MyModal,function(){})
});
}