Make eagerPatches an internal setting

This commit is contained in:
Nuckyz 2024-05-23 19:53:19 -03:00
parent 7b7b87316d
commit bdd4b0f143
No known key found for this signature in database
GPG key ID: 440BF8296E1C4AD9
2 changed files with 12 additions and 10 deletions

View file

@ -66,11 +66,6 @@ function VencordSettings() {
title: "Enable React Developer Tools", title: "Enable React Developer Tools",
note: "Requires a full restart" note: "Requires a full restart"
}, },
{
key: "eagerPatches",
title: "Apply Vencord patches before they are needed",
note: "Increases startup timing, but may make app usage more fluid. Note that the difference of having this on or off is minimal."
},
!IS_WEB && (!IS_DISCORD_DESKTOP || !isWindows ? { !IS_WEB && (!IS_DISCORD_DESKTOP || !isWindows ? {
key: "frameless", key: "frameless",
title: "Disable the window frame", title: "Disable the window frame",

View file

@ -127,10 +127,17 @@ Object.defineProperty(Function.prototype, "O", {
configurable: true, configurable: true,
set(v: OnChunksLoaded["j"]) { set(v: OnChunksLoaded["j"]) {
// @ts-ignore function setValue(target: any) {
delete onChunksLoaded.j; Object.defineProperty(target, "j", {
onChunksLoaded.j = v; value: v,
originalOnChunksLoaded.j = v; configurable: true,
enumerable: true,
writable: true
});
}
setValue(onChunksLoaded);
setValue(originalOnChunksLoaded);
} }
}); });
} }
@ -318,7 +325,7 @@ function patchFactory(id: PropertyKey, factory: ModuleFactory) {
// @ts-ignore // @ts-ignore
originalFactory.$$vencordRequired = true; originalFactory.$$vencordRequired = true;
for (const proxiedModules of allProxiedModules) { for (const proxiedModules of allProxiedModules) {
proxiedModules[id] = originalFactory; Reflect.set(proxiedModules, id, originalFactory);
} }
if (wreq == null && IS_DEV) { if (wreq == null && IS_DEV) {