dialog icon indicating copy to clipboard operation
dialog copied to clipboard

Add whenConfirmed alongside whenClosed

Open m-gallesio opened this issue 5 years ago • 0 comments

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

m-gallesio avatar Oct 11 '19 14:10 m-gallesio