Reporter: Properly implement reporter build of Vencord; Test more plugins; Fix running in wrong pages

This commit is contained in:
Nuckyz 2024-05-30 04:44:13 -03:00
parent 892de53603
commit 9a9c1b0487
No known key found for this signature in database
GPG key ID: 440BF8296E1C4AD9
19 changed files with 184 additions and 145 deletions

View file

@ -22,7 +22,7 @@ import { LazyComponent } from "@utils/react";
import { FilterFn, filters, lazyWebpackSearchHistory, waitFor } from "../webpack";
export function waitForComponent<T extends React.ComponentType<any> = React.ComponentType<any> & Record<string, any>>(name: string, filter: FilterFn | string | string[]): T {
if (IS_DEV) lazyWebpackSearchHistory.push(["waitForComponent", Array.isArray(filter) ? filter : [filter]]);
if (IS_REPORTER) lazyWebpackSearchHistory.push(["waitForComponent", Array.isArray(filter) ? filter : [filter]]);
let myValue: T = function () {
throw new Error(`Vencord could not find the ${name} Component`);
@ -38,7 +38,7 @@ export function waitForComponent<T extends React.ComponentType<any> = React.Comp
}
export function waitForStore(name: string, cb: (v: any) => void) {
if (IS_DEV) lazyWebpackSearchHistory.push(["waitForStore", [name]]);
if (IS_REPORTER) lazyWebpackSearchHistory.push(["waitForStore", [name]]);
waitFor(filters.byStoreName(name), cb, { isIndirect: true });
}