The PromiseRejectionEvent() constructor returns a newly created PromiseRejectionEvent, which represents events fired when a JavaScript Promise is rejected.
Syntax
new PromiseRejectionEvent(type, {
promise: somePromise,
reason : someValue
});
Parameters
The PromiseRejectionEvent() constructor also inherits arguments from Event().
type- A string representing the name of the type of the
PromiseRejectionEvent. This is case-sensitive and must be one of"rejectionhandled"or"unhandledrejection". promise- The
Promisewhich was rejected. reason- Any value or
Objectwhich represents the reason the promise was rejected.
Specifications
| Specification | Status | Comment |
|---|---|---|
| WHATWG HTML Living Standard The definition of 'PromiseRejectionEvent()' in that specification. |
Living Standard | Initial definition. |
Browser compatibility
| Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
|---|---|---|---|---|---|
| Basic support | 49 | No support | No support | No support | No support |
| Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
|---|---|---|---|---|---|
| Basic support | No support | No support | No support | No support | No support |