diff options
author | Vendicated <vendicated@riseup.net> | 2022-12-20 00:33:52 +0100 |
---|---|---|
committer | Vendicated <vendicated@riseup.net> | 2022-12-20 00:34:26 +0100 |
commit | 94ad8e8f61abb3c6256f9caa39878150b326790f (patch) | |
tree | 8cda13f72b1778ab667bf8761fee981a7673dcbd /src/webpack | |
parent | 989bd36eeb6dd6c4b391900765847cdcf87484d9 (diff) | |
download | Vencord-94ad8e8f61abb3c6256f9caa39878150b326790f.tar.gz Vencord-94ad8e8f61abb3c6256f9caa39878150b326790f.tar.bz2 Vencord-94ad8e8f61abb3c6256f9caa39878150b326790f.zip |
Add useEffect/useState/useMemo to webpack commons
Diffstat (limited to 'src/webpack')
-rw-r--r-- | src/webpack/common.tsx | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/webpack/common.tsx b/src/webpack/common.tsx index 31175f9..f2c42d1 100644 --- a/src/webpack/common.tsx +++ b/src/webpack/common.tsx @@ -31,7 +31,12 @@ export const Margins = findByPropsLazy("marginTop20"); export let FluxDispatcher: Other.FluxDispatcher; export const Flux = findByPropsLazy("connectStores"); + export let React: typeof import("react"); +export let useState: typeof React.useState; +export let useEffect: typeof React.useEffect; +export let useMemo: typeof React.useMemo; + export const ReactDOM: typeof import("react-dom") = findByPropsLazy("createPortal", "render"); export const RestAPI = findByPropsLazy("getAPIBaseURL", "get"); @@ -76,7 +81,7 @@ export const TextArea = findByCodeLazy("handleSetRef", "textArea") as React.Comp export const Select = LazyComponent(() => findByCode("optionClassName", "popoutPosition", "autoFocus", "maxVisibleItems")); export const Slider = LazyComponent(() => findByCode("closestMarkerIndex", "stickToMarkers")); -export let SnowflakeUtils: { fromTimestamp: (timestamp: number) => string, extractTimestamp: (snowflake: string) => number }; +export let SnowflakeUtils: { fromTimestamp: (timestamp: number) => string, extractTimestamp: (snowflake: string) => number; }; waitFor(["fromTimestamp", "extractTimestamp"], m => SnowflakeUtils = m); export let Parser: any; @@ -151,7 +156,10 @@ export const NavigationRouter = mapMangledModuleLazy("Transitioning to external goForward: filters.byCode("goForward()"), }); -waitFor("useState", m => React = m); +waitFor("useState", m => { + React = m; + ({ useEffect, useState, useMemo } = React); +}); waitFor(["dispatch", "subscribe"], m => { FluxDispatcher = m; |