Властивість onunhandledrejection
домішки WindowEventHandlers
- це EventHandler
для обробки подій unhandledrejection. Ці події виникають для необроблених відхилень об'єктів Promise
.
Синтаксис
window.onunhandledrejection = function;
Значення
function
- це EventHandler
або функція, яку треба викликати, коли вікно отримує події unhandledrejection
. Обробник подій отримує вхідний параметр як PromiseRejectionEvent
.
Приклади
Цей приклад просто виводить у консоль значення reason
(причина) необроблених відхилень.
window.onunhandledrejection = function(e) {
console.log(e.reason);
}
Специфікації
Специфікація | Статус | Коментар |
---|---|---|
HTML Living Standard The definition of 'onunhandledrejection' in that specification. |
Living Standard | Початкове визначення. |
Сумісність з веб-переглядачами
BCD tables only load in the browser
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.