mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-15 17:43:08 -04:00
ConsoleShortcuts: fix module preloader
This commit is contained in:
parent
fe0309ffaa
commit
a8c01a2a05
1 changed files with 11 additions and 9 deletions
|
@ -20,6 +20,7 @@ import { Devs } from "@utils/constants";
|
|||
import { getCurrentChannel, getCurrentGuild } from "@utils/discord";
|
||||
import { runtimeHashMessageKey } from "@utils/intlHash";
|
||||
import { SYM_LAZY_CACHED, SYM_LAZY_GET } from "@utils/lazy";
|
||||
import { sleep } from "@utils/misc";
|
||||
import { ModalAPI } from "@utils/modal";
|
||||
import { relaunch } from "@utils/native";
|
||||
import { canonicalizeMatch, canonicalizeReplace, canonicalizeReplacement } from "@utils/patches";
|
||||
|
@ -206,10 +207,13 @@ function loadAndCacheShortcut(key: string, val: any, forceLoad: boolean) {
|
|||
return value;
|
||||
}
|
||||
|
||||
const webpackModulesProbablyLoaded = Webpack.onceReady.then(() => sleep(1000));
|
||||
|
||||
export default definePlugin({
|
||||
name: "ConsoleShortcuts",
|
||||
description: "Adds shorter Aliases for many things on the window. Run `shortcutList` for a list.",
|
||||
authors: [Devs.Ven],
|
||||
startAt: StartAt.Init,
|
||||
|
||||
patches: [
|
||||
{
|
||||
|
@ -221,7 +225,7 @@ export default definePlugin({
|
|||
}
|
||||
],
|
||||
|
||||
startAt: StartAt.Init,
|
||||
|
||||
start() {
|
||||
const shortcuts = makeShortcuts();
|
||||
window.shortcutList = {};
|
||||
|
@ -242,18 +246,16 @@ export default definePlugin({
|
|||
}
|
||||
|
||||
// unproxy loaded modules
|
||||
Webpack.onceReady.then(() => {
|
||||
setTimeout(() => this.eagerLoad(false), 1000);
|
||||
this.eagerLoad(false);
|
||||
|
||||
if (!IS_WEB) {
|
||||
const Native = VencordNative.pluginHelpers.ConsoleShortcuts as PluginNative<typeof import("./native")>;
|
||||
Native.initDevtoolsOpenEagerLoad();
|
||||
}
|
||||
});
|
||||
if (!IS_WEB) {
|
||||
const Native = VencordNative.pluginHelpers.ConsoleShortcuts as PluginNative<typeof import("./native")>;
|
||||
Native.initDevtoolsOpenEagerLoad();
|
||||
}
|
||||
},
|
||||
|
||||
async eagerLoad(forceLoad: boolean) {
|
||||
await Webpack.onceReady;
|
||||
await webpackModulesProbablyLoaded;
|
||||
|
||||
const shortcuts = makeShortcuts();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue