Mozda ovako nekako, nisam testiro tako da ne mogu nista da garantiram
const confirm = (message) => new Promise((resolve, reject) => {
if (somethingAboutDialog()) {
return resolve(true)
}
reject(false)
})
const myFunc = async() => {
foo()
bar()
if (await !confirm('hello')) return;
etc()
}
Zavisi od aplikacije.Sta ako u pozadini imas neki WebSocket, meh ?