Files
discord-decomp/modules/app_startup/ManagerRegistryShared.tsx
T
2026-11-01 12:12:55 +02:00

66 lines
1.9 KiB
TypeScript

// Metro module 16729 (f16730).
import Dispatcher from "../../Dispatcher";
let c12058_2, c12058_3, handleAction;
const populateMap = function populateMap(a0) {
let actions = a0.actions;
if (actions == null) {
actions = [];
}
const r9 = a0.hasStoreChangeListeners || a0.loadAfterConnectionOpen ? actions.includes("POST_CONNECTION_OPEN") ? actions : [...actions, "POST_CONNECTION_OPEN"] : actions;
const r28 = a0.loadRightBeforeConnectionOpen ? r9.includes("CONNECTION_OPEN") ? r9 : [...r9, "CONNECTION_OPEN"] : r9;
for (const item of r28) {
if (!(item in c12058_2)) {
c12058_2[item] = [];
}
c12058_2[item].push(a0);
}
};
handleAction = function handleAction(a0) {
let r19;
if (!(a0.type !== "CONNECTION_OPEN" && a0.type !== "OVERLAY_INITIALIZE")) {
c12058_3 = true;
}
if (a0.type in c12058_2) {
const r26 = [];
let r29 = c12058_2[a0.type][Symbol.iterator]();
const next = r29.next;
while (true) {
const r32 = r29 === void 0 ? void 0 : (r19 = next.call(r29)).done ? r29 = void 0 : r19.value;
if (r29 === void 0) {
if (r26.length > 0) {
c12058_2[a0.type] = r26;
break;
}
delete c12058_2[a0.type];
break;
}
try {
if (!c12058_3 && r32.neverLoadBeforeConnectionOpen) {
r26.push(r32);
continue;
}
r32.inlineRequire().initialize();
} catch (r45) {
if (r29 !== void 0 && typeof r29.return === "function") {
try {
r29.return();
} catch {}
}
throw r45;
}
}
}
return false;
};
new Set(["CHANNEL_SELECT", "CHANNEL_PRELOAD", "MESSAGE_CREATE"]);
c12058_2 = {};
c12058_3 = false;
export function initialize(a0) {
for (const key in a0) {
const r10 = a0[key];
r10.actions;
populateMap(r10);
}
Dispatcher.addInterceptor(handleAction);
}