allow plugins to specify how soon their start() method is called

This commit is contained in:
V 2023-11-22 06:14:16 +01:00
parent 074ebae334
commit 371b5b0be8
No known key found for this signature in database
GPG key ID: A1DC0CFB5615D905
4 changed files with 38 additions and 24 deletions

View file

@ -27,6 +27,8 @@ export { PlainSettings, Settings };
import "./utils/quickCss";
import "./webpack/patchWebpack";
import { StartAt } from "@utils/types";
import { get as dsGet } from "./api/DataStore";
import { showNotification } from "./api/Notifications";
import { PlainSettings, Settings } from "./api/Settings";
@ -79,7 +81,7 @@ async function syncSettings() {
async function init() {
await onceReady;
startAllPlugins();
startAllPlugins(StartAt.WebpackReady);
syncSettings();
@ -130,13 +132,17 @@ async function init() {
}
}
startAllPlugins(StartAt.Init);
init();
if (IS_DISCORD_DESKTOP && Settings.winNativeTitleBar && navigator.platform.toLowerCase().startsWith("win")) {
document.addEventListener("DOMContentLoaded", () => {
document.addEventListener("DOMContentLoaded", () => {
startAllPlugins(StartAt.DOMContentLoaded);
if (IS_DISCORD_DESKTOP && Settings.winNativeTitleBar && navigator.platform.toLowerCase().startsWith("win")) {
document.head.append(Object.assign(document.createElement("style"), {
id: "vencord-native-titlebar-style",
textContent: "[class*=titleBar]{display: none!important}"
}));
}, { once: true });
}
}
}, { once: true });