Files
discord-decomp/_bundle/Module1022.js
T
2026-11-01 12:12:55 +02:00

99 lines
2.8 KiB
JavaScript

// Metro module 1022 (f1023).
import { _37, _87 } from "./Promise_1019";
function $mk67506($env) {
return function(a0) {
return $env[0] instanceof a0;
};
}
let c838_2 = [ReferenceError, TypeError, RangeError];
let c838_3 = false;
export function disable() {
c838_3 = false;
_37 = null;
_87 = null;
}
export function enable(a0) {
let c12636_1, c12636_2, c12636_3;
let r5 = a0;
let c12636_0 = a0;
const onUnhandled2 = function onUnhandled(a0) {
let allRejections = c12636_0.allRejections;
if (!allRejections) {
const error = c12636_3[a0].error;
const r6 = c12636_0.whitelist || c838_2;
let env23991;
const r11 = env23991 = {};
env23991[0] = error;
allRejections = r6.some($mk67506(r11));
}
if (allRejections) {
const r15 = c12636_3[a0];
const displayId2 = +c12636_2;
c12636_2 = displayId2 + 1;
r15.displayId = displayId2;
const onUnhandled3 = c12636_0.onUnhandled;
c12636_3[a0].logged = true;
if (onUnhandled3) {
c12636_0.onUnhandled(c12636_3[a0].displayId, c12636_3[a0].error);
} else {
const displayId = c12636_3[a0].displayId;
const error2 = c12636_3[a0].error;
console.warn("Possible Unhandled Promise Rejection (id: " + displayId + "):");
("" + (error2 && (error2.stack || error2))).split("\n").forEach(function(item) {
console.warn(" " + item);
});
}
}
};
if (!a0) {
r5 = {};
}
c12636_0 = r5;
if (c838_3) {
c838_3 = false;
_37 = null;
_87 = null;
}
c838_3 = true;
c12636_1 = 0;
c12636_2 = 0;
c12636_3 = {};
_37 = function(a0) {
if (a0._65 === 2 && c12636_3[a0._51]) {
if (c12636_3[a0._51].logged) {
const _51 = a0._51;
if (c12636_3[_51].logged) {
if (c12636_0.onHandled) {
c12636_0.onHandled(c12636_3[_51].displayId, c12636_3[_51].error);
} else if (!c12636_3[_51].onUnhandled) {
console.warn("Promise Rejection Handled (id: " + c12636_3[_51].displayId + "):");
console.warn(" This means you can ignore any previous messages of the form \"Possible Unhandled Promise Rejection\" with id " + c12636_3[_51].displayId + ".");
}
}
} else {
clearTimeout(c12636_3[a0._51].timeout);
}
delete c12636_3[a0._51];
}
};
_87 = function(a0, a1) {
if (a0._40 === 0) {
let env23992;
const _512 = +c12636_1;
c12636_1 = _512 + 1;
a0._51 = _512;
const _51 = a0._51;
const r15 = setTimeout;
const r18 = onUnhandled2.bind(null, a0._51);
const r21 = env23992 = {};
env23992[0] = a1;
c12636_3[_51] = {
displayId: null,
error: a1,
timeout: r15(r18, c838_2.some($mk67506(r21)) ? 100 : 2000),
logged: false
};
}
};
}