Re: [w3c/browser-payment-api] Adding dialog close event (#387)

Promises have a way to do this: rejecting a promise. Merchants handle promise rejection via `.catch(errorHandler)` call. Let's specify that user dismissal of the dialog should trigger rejection of the `.show()` promise with a "Request cancelled" message. For example:

```javascript
new PaymentRequest(methodData, details, options)
.show().then(handlePayment)
.catch(error => {
    console.log(error);  // Should print "Request cancelled" on dismissing the dialog.
});
```

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/browser-payment-api/issues/387#issuecomment-269481060

Received on Wednesday, 28 December 2016 14:03:51 UTC