Merge branch 'immediate-finds' into immediate-finds-modules-proxy

This commit is contained in:
Nuckyz 2024-05-28 18:03:35 -03:00
commit 96d5e1b89b
No known key found for this signature in database
GPG key ID: 440BF8296E1C4AD9
4 changed files with 9 additions and 9 deletions

View file

@ -39,7 +39,7 @@ import { localStorage } from "./utils/localStorage";
import { relaunch } from "./utils/native";
import { getCloudSettings, putCloudSettings } from "./utils/settingsSync";
import { checkForUpdates, update, UpdateLogger } from "./utils/updater";
import { onceReady } from "./webpack";
import { onceDiscordLoaded } from "./webpack";
import { SettingsRouter } from "./webpack/common";
async function syncSettings() {
@ -82,7 +82,7 @@ async function syncSettings() {
}
async function init() {
await onceReady;
await onceDiscordLoaded;
startAllPlugins(StartAt.WebpackReady);
syncSettings();

View file

@ -188,7 +188,7 @@ export default definePlugin({
}
// unproxy loaded modules
Webpack.onceReady.then(() => {
Webpack.onceDiscordLoaded.then(() => {
setTimeout(() => this.eagerLoad(false), 1000);
if (!IS_WEB) {
@ -199,7 +199,7 @@ export default definePlugin({
},
async eagerLoad(forceLoad: boolean) {
await Webpack.onceReady;
await Webpack.onceDiscordLoaded;
const shortcuts = makeShortcuts();

View file

@ -17,7 +17,7 @@
*/
// eslint-disable-next-line path-alias/no-relative
import { _resolveReady, filters, find, findByCode, findByProps, waitFor } from "../webpack";
import { _resolveDiscordLoaded, filters, find, findByCode, findByProps, waitFor } from "../webpack";
import type * as t from "./types/utils";
export const FluxDispatcher = find<t.FluxDispatcher>(filters.byProps("dispatch", "subscribe"), (m: t.FluxDispatcher) => {
@ -26,7 +26,7 @@ export const FluxDispatcher = find<t.FluxDispatcher>(filters.byProps("dispatch",
const cb = () => {
m.unsubscribe("CONNECTION_OPEN", cb);
_resolveReady();
_resolveDiscordLoaded();
};
m.subscribe("CONNECTION_OPEN", cb);

View file

@ -17,12 +17,12 @@ import { ModuleExports, ModuleFactory, WebpackRequire } from "./wreq";
const logger = new Logger("Webpack");
export let _resolveReady: () => void;
export let _resolveDiscordLoaded: () => void;
/**
* Fired once a gateway connection to Discord has been established.
* This indicates that the core webpack modules have been initialised
* This indicates that the core Webpack modules have been initialized, and we are logged in.
*/
export const onceReady = new Promise<void>(r => _resolveReady = r);
export const onceDiscordLoaded = new Promise<void>(r => _resolveDiscordLoaded = r);
export let wreq: WebpackRequire;
export let cache: WebpackRequire["c"];