The idea: Call async customPrompt()
wait, return on button click true
or false
.
Currently I can display the prompt as it should be but I am stuck at the event listeners as the function only return unresolved promise
async function customPrompt() {
prompt.classList.add('show);
prompt.querySelector('.btnTrue').addEventListener('click', () => {
return true;
})
prompt.querySelector('.btnFalse').addEventListener('click', () => {
return false;
})
}
How can I resolve the promise as soon as one of the buttons is clicked?
PS: I am pretty new to async/await but could not find any article online about something like this
Any help is appreciated ;)