misc fixes
This commit is contained in:
parent
4753efa33c
commit
4cc6789b5b
|
@ -89,8 +89,8 @@ export const isStyleEnabled = (name: string) => requireStyle(name).dom?.isConnec
|
||||||
* // -- plugin.ts --
|
* // -- plugin.ts --
|
||||||
* import pluginStyle from "./plugin.css?managed";
|
* import pluginStyle from "./plugin.css?managed";
|
||||||
* import { setStyleVars } from "@api/Styles";
|
* import { setStyleVars } from "@api/Styles";
|
||||||
* import { findByPropsLazy } from "@webpack";
|
* import { findByProps } from "@webpack";
|
||||||
* const classNames = findByPropsLazy("thin", "scrollerBase"); // { thin: "thin-31rlnD scrollerBase-_bVAAt", ... }
|
* const classNames = findByProps("thin", "scrollerBase"); // { thin: "thin-31rlnD scrollerBase-_bVAAt", ... }
|
||||||
*
|
*
|
||||||
* // Inside some plugin method like "start()"
|
* // Inside some plugin method like "start()"
|
||||||
* setStyleClassNames(pluginStyle, classNames);
|
* setStyleClassNames(pluginStyle, classNames);
|
||||||
|
|
|
@ -52,7 +52,6 @@ const PreloadedUserSettingsActionCreators = webpackDependantLazy(() => UserSetti
|
||||||
const AppearanceSettingsActionCreators = webpackDependantLazy(() => searchProtoClassField("appearance", PreloadedUserSettingsActionCreators.ProtoClass));
|
const AppearanceSettingsActionCreators = webpackDependantLazy(() => searchProtoClassField("appearance", PreloadedUserSettingsActionCreators.ProtoClass));
|
||||||
const ClientThemeSettingsActionsCreators = webpackDependantLazy(() => searchProtoClassField("clientThemeSettings", AppearanceSettingsActionCreators));
|
const ClientThemeSettingsActionsCreators = webpackDependantLazy(() => searchProtoClassField("clientThemeSettings", AppearanceSettingsActionCreators));
|
||||||
|
|
||||||
|
|
||||||
const enum EmojiIntentions {
|
const enum EmojiIntentions {
|
||||||
REACTION = 0,
|
REACTION = 0,
|
||||||
STATUS = 1,
|
STATUS = 1,
|
||||||
|
|
|
@ -91,7 +91,7 @@ export function proxyLazy<T = any>(factory: () => T, attempts = 5, isChild = fal
|
||||||
// If we're still in the same tick, it means the lazy was immediately used.
|
// If we're still in the same tick, it means the lazy was immediately used.
|
||||||
// thus, we lazy proxy the get access to make things like destructuring work as expected
|
// thus, we lazy proxy the get access to make things like destructuring work as expected
|
||||||
// meow here will also be a lazy
|
// meow here will also be a lazy
|
||||||
// `const { meow } = findByPropsLazy("meow");`
|
// `const { meow } = proxyLazy(() => ({ meow: [] }));`
|
||||||
if (!isChild && isSameTick) {
|
if (!isChild && isSameTick) {
|
||||||
return proxyLazy(
|
return proxyLazy(
|
||||||
() => Reflect.get(target[proxyLazyGet](), p, receiver),
|
() => Reflect.get(target[proxyLazyGet](), p, receiver),
|
||||||
|
|
|
@ -341,7 +341,7 @@ export function findStore<T = any>(name: string) {
|
||||||
* @param filter A function that takes a module and returns a boolean
|
* @param filter A function that takes a module and returns a boolean
|
||||||
* @returns The found module or null
|
* @returns The found module or null
|
||||||
*/
|
*/
|
||||||
export const cacheFind = traceFunction("find", function find(filter: FilterFn) {
|
export const cacheFind = traceFunction("cacheFind", function cacheFind(filter: FilterFn) {
|
||||||
if (typeof filter !== "function")
|
if (typeof filter !== "function")
|
||||||
throw new Error("Invalid filter. Expected a function got " + typeof filter);
|
throw new Error("Invalid filter. Expected a function got " + typeof filter);
|
||||||
|
|
||||||
|
@ -389,7 +389,7 @@ export function cacheFindAll(filter: FilterFn) {
|
||||||
* need it afterwards, pass a copy.
|
* need it afterwards, pass a copy.
|
||||||
* @returns Array of results in the same order as the passed filters
|
* @returns Array of results in the same order as the passed filters
|
||||||
*/
|
*/
|
||||||
export const cacheFindBulk = traceFunction("findBulk", function findBulk(...filterFns: FilterFn[]) {
|
export const cacheFindBulk = traceFunction("cacheFindBulk", function cacheFindBulk(...filterFns: FilterFn[]) {
|
||||||
if (!Array.isArray(filterFns))
|
if (!Array.isArray(filterFns))
|
||||||
throw new Error("Invalid filters. Expected function[] got " + typeof filterFns);
|
throw new Error("Invalid filters. Expected function[] got " + typeof filterFns);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue