aurelia / dialog

A dialog plugin for Aurelia.
MIT License
106 stars 115 forks source link

Add whenConfirmed alongside whenClosed #386

Closed m-gallesio closed 2 years ago

m-gallesio commented 4 years ago

I'm submitting a feature request

It would be nice to have a whenConfirmed method as a shortcut for:

dialogService.open(...)
.whenClosed(response => {
if (!response.wasCancelled) {
// do something
}
});

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).

m-gallesio commented 2 years ago

Nevermind, I figured this out.