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