mirror of
https://github.com/denoland/deno.git
synced 2025-08-04 10:59:13 +00:00
feat: "rejectionhandled" Web event and "rejectionHandled" Node event (#21875)
This commit adds support for "rejectionhandled" Web Event and "rejectionHandled" Node event. ```js import process from "node:process"; process.on("rejectionHandled", (promise) => { console.log("rejectionHandled", reason, promise); }); window.addEventListener("rejectionhandled", (event) => { console.log("rejectionhandled", event.reason, event.promise); }); ``` --------- Co-authored-by: Matt Mastracci <matthew@mastracci.com>
This commit is contained in:
parent
288774c5ed
commit
7471587d29
9 changed files with 106 additions and 1 deletions
4
cli/tsc/dts/lib.deno.window.d.ts
vendored
4
cli/tsc/dts/lib.deno.window.d.ts
vendored
|
@ -12,6 +12,7 @@
|
|||
declare interface WindowEventMap {
|
||||
"error": ErrorEvent;
|
||||
"unhandledrejection": PromiseRejectionEvent;
|
||||
"rejectionhandled": PromiseRejectionEvent;
|
||||
}
|
||||
|
||||
/** @category Web APIs */
|
||||
|
@ -25,6 +26,9 @@ declare interface Window extends EventTarget {
|
|||
onunhandledrejection:
|
||||
| ((this: Window, ev: PromiseRejectionEvent) => any)
|
||||
| null;
|
||||
onrejectionhandled:
|
||||
| ((this: Window, ev: PromiseRejectionEvent) => any)
|
||||
| null;
|
||||
close: () => void;
|
||||
readonly closed: boolean;
|
||||
alert: (message?: string) => void;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue