dialog
dialog copied to clipboard
Add whenConfirmed alongside whenClosed
I'm submitting a feature request
- Expected/desired behavior:
It would be nice to have a whenConfirmed
method as a shortcut for:
dialogService.open(...)
.whenClosed(response => {
if (!response.wasCancelled) {
// do something
}
});
- What is the motivation / use case for changing the behavior?
Oftentimes we just need to handle a "confirmed" outcome and discard a "cancelled" one.
This can be handled with rejectOnClose
, but rejecting a promise seems too strong (akin to throwing an exception) for what is meant to be a regular operation (e.g. the user realizes the action about to be performed is not desired or just decides to not proceed).