aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/index.ts
diff options
context:
space:
mode:
authorVendicated <vendicated@riseup.net>2022-11-07 21:05:33 +0100
committerVendicated <vendicated@riseup.net>2022-11-07 21:05:33 +0100
commit0af4579204fcbabbce239b2fbd4dfef0df58774d (patch)
tree4e39a537bdd5bfd50ac11ba80bd39288b0bf061b /src/plugins/index.ts
parent851d07f31a117cf342d09c0886ae0b38ae0c9050 (diff)
downloadVencord-0af4579204fcbabbce239b2fbd4dfef0df58774d.tar.gz
Vencord-0af4579204fcbabbce239b2fbd4dfef0df58774d.tar.bz2
Vencord-0af4579204fcbabbce239b2fbd4dfef0df58774d.zip
Add tracer, fix MessageActions slow startup
Diffstat (limited to 'src/plugins/index.ts')
-rw-r--r--src/plugins/index.ts13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/plugins/index.ts b/src/plugins/index.ts
index 86d44b4..d3842aa 100644
--- a/src/plugins/index.ts
+++ b/src/plugins/index.ts
@@ -20,6 +20,7 @@ import Plugins from "~plugins";
import { registerCommand, unregisterCommand } from "../api/Commands";
import { Settings } from "../api/settings";
+import { traceFunction } from "../debug/Tracer";
import Logger from "../utils/logger";
import { Patch, Plugin } from "../utils/types";
@@ -43,12 +44,12 @@ for (const p of Object.values(Plugins))
}
}
-export function startAllPlugins() {
+export const startAllPlugins = traceFunction("startAllPlugins", function startAllPlugins() {
for (const name in Plugins)
if (isPluginEnabled(name)) {
startPlugin(Plugins[name]);
}
-}
+});
export function startDependenciesRecursive(p: Plugin) {
let restartNeeded = false;
@@ -70,7 +71,7 @@ export function startDependenciesRecursive(p: Plugin) {
return { restartNeeded, failures };
}
-export function startPlugin(p: Plugin) {
+export const startPlugin = traceFunction("startPlugin", function startPlugin(p: Plugin) {
if (p.start) {
logger.info("Starting plugin", p.name);
if (p.started) {
@@ -100,9 +101,9 @@ export function startPlugin(p: Plugin) {
}
return true;
-}
+}, p => `startPlugin ${p.name}`);
-export function stopPlugin(p: Plugin) {
+export const stopPlugin = traceFunction("stopPlugin", function stopPlugin(p: Plugin) {
if (p.stop) {
logger.info("Stopping plugin", p.name);
if (!p.started) {
@@ -131,4 +132,4 @@ export function stopPlugin(p: Plugin) {
}
return true;
-}
+}, p => `stopPlugin ${p.name}`);