onceReady -> onceDiscordLoaded
This commit is contained in:
parent
011b375d02
commit
4b4caa798a
|
@ -39,7 +39,7 @@ import { localStorage } from "./utils/localStorage";
|
||||||
import { relaunch } from "./utils/native";
|
import { relaunch } from "./utils/native";
|
||||||
import { getCloudSettings, putCloudSettings } from "./utils/settingsSync";
|
import { getCloudSettings, putCloudSettings } from "./utils/settingsSync";
|
||||||
import { checkForUpdates, update, UpdateLogger } from "./utils/updater";
|
import { checkForUpdates, update, UpdateLogger } from "./utils/updater";
|
||||||
import { onceReady } from "./webpack";
|
import { onceDiscordLoaded } from "./webpack";
|
||||||
import { SettingsRouter } from "./webpack/common";
|
import { SettingsRouter } from "./webpack/common";
|
||||||
|
|
||||||
async function syncSettings() {
|
async function syncSettings() {
|
||||||
|
@ -82,7 +82,7 @@ async function syncSettings() {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function init() {
|
async function init() {
|
||||||
await onceReady;
|
await onceDiscordLoaded;
|
||||||
startAllPlugins(StartAt.WebpackReady);
|
startAllPlugins(StartAt.WebpackReady);
|
||||||
|
|
||||||
syncSettings();
|
syncSettings();
|
||||||
|
|
|
@ -188,7 +188,7 @@ export default definePlugin({
|
||||||
}
|
}
|
||||||
|
|
||||||
// unproxy loaded modules
|
// unproxy loaded modules
|
||||||
Webpack.onceReady.then(() => {
|
Webpack.onceDiscordLoaded.then(() => {
|
||||||
setTimeout(() => this.eagerLoad(false), 1000);
|
setTimeout(() => this.eagerLoad(false), 1000);
|
||||||
|
|
||||||
if (!IS_WEB) {
|
if (!IS_WEB) {
|
||||||
|
@ -199,7 +199,7 @@ export default definePlugin({
|
||||||
},
|
},
|
||||||
|
|
||||||
async eagerLoad(forceLoad: boolean) {
|
async eagerLoad(forceLoad: boolean) {
|
||||||
await Webpack.onceReady;
|
await Webpack.onceDiscordLoaded;
|
||||||
|
|
||||||
const shortcuts = makeShortcuts();
|
const shortcuts = makeShortcuts();
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// eslint-disable-next-line path-alias/no-relative
|
// 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";
|
import type * as t from "./types/utils";
|
||||||
|
|
||||||
export const FluxDispatcher = find<t.FluxDispatcher>(filters.byProps("dispatch", "subscribe"), (m: t.FluxDispatcher) => {
|
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 = () => {
|
const cb = () => {
|
||||||
m.unsubscribe("CONNECTION_OPEN", cb);
|
m.unsubscribe("CONNECTION_OPEN", cb);
|
||||||
_resolveReady();
|
_resolveDiscordLoaded();
|
||||||
};
|
};
|
||||||
m.subscribe("CONNECTION_OPEN", cb);
|
m.subscribe("CONNECTION_OPEN", cb);
|
||||||
|
|
||||||
|
|
|
@ -17,12 +17,12 @@ import { GenericStore } from "./common";
|
||||||
|
|
||||||
const logger = new Logger("Webpack");
|
const logger = new Logger("Webpack");
|
||||||
|
|
||||||
export let _resolveReady: () => void;
|
export let _resolveDiscordLoaded: () => void;
|
||||||
/**
|
/**
|
||||||
* Fired once a gateway connection to Discord has been established.
|
* 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: WebpackInstance;
|
export let wreq: WebpackInstance;
|
||||||
export let cache: WebpackInstance["c"];
|
export let cache: WebpackInstance["c"];
|
||||||
|
|
Loading…
Reference in a new issue