Debian Codegraph @

essentials/index.js

raw
1 "use strict";
2
3 var uniGlobal = require("uni-global")("medikoo/essentials/202112");
4
5 if (uniGlobal.isSetup) {
6 // Doubled load of essentials, abort
7 return;
8 }
9
10 uniGlobal.isSetup = true;
11
12 // 1. Expose every stack frame in error stack trace
13 Error.stackTraceLimit = Infinity;
14
15 // 2. Expose unhandled promise rejections as uncaught exceptions
16 if (typeof process === "object" && process && typeof process.on === "function") {
17 // Node.js
18 process.on("unhandledRejection", function (reason) {
19 // If user attached its own unhandledRejection handler, abort
20 if (process.listenerCount("unhandledRejection") > 1) return;
21 throw reason;
22 });
23 }
24 if (typeof addEventListener === "function") {
25 // HTML
26 addEventListener("unhandledrejection", function (event) {
27 event.preventDefault();
28 throw event.reason;
29 });
30 }