PaymentRequest: abort() Methode
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Sicherer Kontext: Diese Funktion ist nur in sicheren Kontexten (HTTPS) in einigen oder allen unterstützenden Browsern verfügbar.
Die PaymentRequest.abort()
-Methode des PaymentRequest
Interfaces veranlasst den Benutzeragenten, die Zahlungsanforderung zu beenden und jegliche Benutzeroberfläche zu entfernen, die möglicherweise angezeigt wird.
Syntax
abort()
Parameter
Keine.
Rückgabewert
Keiner (undefined
).
Beispiele
Das folgende Beispiel richtet einen Timeout ein, um die Zahlungsanforderung zu löschen, die möglicherweise verlassen oder vernachlässigt wurde.
const request = new PaymentRequest(supportedInstruments, details, options);
const paymentTimeout = setTimeout(
() => {
clearTimeout(paymentTimeout);
request
.abort()
.then(() => {
print("Payment timed out after 20 minutes.");
})
.catch(() => {
print(
"Unable to abort, because the user is currently in the process " +
"of paying.",
);
});
},
20 * 60 * 1000,
); /* 20 minutes */
Spezifikationen
Specification |
---|
Payment Request API # dom-paymentrequest-abort |
Browser-Kompatibilität
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
abort() |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- No support
- No support
- User must explicitly enable this feature.