2023-01-16 22:52:23 +00:00
|
|
|
// Hoist required modules
|
|
|
|
|
// This used to be in filters.ts, but things became convoluted
|
|
|
|
|
|
2023-03-17 21:58:37 +00:00
|
|
|
import { initThemes } from "@lib/themes";
|
|
|
|
|
|
2023-01-16 22:52:23 +00:00
|
|
|
// Early find logic
|
2023-02-14 18:28:27 +00:00
|
|
|
const basicFind = (prop: string) => Object.values(window.modules).find(m => m?.publicModule.exports?.[prop])?.publicModule?.exports;
|
2023-01-16 22:52:23 +00:00
|
|
|
|
|
|
|
|
// Hoist React on window
|
2023-02-26 22:56:36 +00:00
|
|
|
window.React = basicFind("createElement") as typeof import("react");
|
2023-01-16 22:52:23 +00:00
|
|
|
|
|
|
|
|
// Export ReactNative
|
2023-02-26 22:56:36 +00:00
|
|
|
export const ReactNative = basicFind("AppRegistry") as typeof import("react-native");
|
2023-01-16 22:52:23 +00:00
|
|
|
|
2023-01-17 08:01:53 +00:00
|
|
|
// Export Discord's constants
|
2023-03-17 21:58:37 +00:00
|
|
|
export const constants = basicFind("AbortCodes");
|
|
|
|
|
|
|
|
|
|
// Export Discord's color module
|
|
|
|
|
export const color = basicFind("SemanticColor");
|
|
|
|
|
|
|
|
|
|
// Themes
|
|
|
|
|
if (window.__vendetta_loader?.features.themes) {
|
|
|
|
|
try {
|
|
|
|
|
initThemes(color);
|
|
|
|
|
} catch (e) {
|
|
|
|
|
console.error("[Vendetta] Failed to initialize themes...", e);
|
|
|
|
|
}
|
|
|
|
|
}
|