Namespace: SpawnDev.SpawnJS.JSObjects
Inherits: Event
Source: JSObjects/PromiseRejectionEvent.cs
MDN Reference: PromiseRejectionEvent on MDN
The PromiseRejectionEvent interface represents events which are sent to the global script context when JavaScript Promises are rejected. These events are particularly useful for telemetry and debugging purposes. https://developer.mozilla.org/en-US/docs/Web/API/PromiseRejectionEvent
| Signature | Description |
|---|---|
PromiseRejectionEvent(SpawnJSObjectReference _ref) |
Deserialization constructor |
| Property | Type | Access | Description |
|---|---|---|---|
Promise |
Promise |
get | The JavaScript Promise that was rejected. |
| Method | Return Type | Description |
|---|---|---|
ReasonAs() |
T |
A value or Object indicating why the promise was rejected, as passed to Promise.reject(). |
SpawnDev.SpawnJS Mapping Note: The JavaScript examples below show the standard Web API usage. In SpawnDev.SpawnJS, the same API is available with C# conventions:
- Properties and methods use PascalCase (e.g.,
readyStatebecomesReadyState)- Events use ActionEvent with
+=/-=(e.g.,addEventListener("click", fn)becomesOnClick += handler)- Async methods return
Task<T>instead ofPromise<T>- Objects should be disposed with
usingstatements- Access via
JS.Get<PromiseRejectionEvent>(...)or constructornew PromiseRejectionEvent(...)
window.onunhandledrejection = (e) => {
console.log(e.reason);
};