I'm currently doing this to async/await Messager dialogs calls. (this is in a functional component with useRef() )
let res = await new Promise(resolve => {
messager.current.confirm({
title: "Question",
msg: "Do you like async/await?",
buttons: [
{ text: "yes", value: true },
{ text: "no", value: false },
],
result: r => {
resolve(r);
}
});
});
Would it be possible to add an async/await pattern when the "result" callback isn't provided? Examples for how that would be called:
let res = await messager.current.confirm({
title: "Question",
msg: "Do you like async/await?",
buttons: [
{ text: "yes", value: true },
{ text: "no", value: false },
],
});
or
let answer = await messager.current.confirm({
title: "Question",
msg: "Do you like async/await?",
buttons: [
{ text: "yes", value: true },
{ text: "no", value: false },
],
}).then(r=> {
return r ? "I like it" : "I can do without"
});