Fix getComponentByRegex and add Filters to the plugin API
This commit is contained in:
parent
1e643b8164
commit
504221ce28
|
@ -18,7 +18,7 @@ import PluginManager from './pluginmanager';
|
||||||
import ThemeManager from './thememanager';
|
import ThemeManager from './thememanager';
|
||||||
import Events from './events';
|
import Events from './events';
|
||||||
import EventsWrapper from './eventswrapper';
|
import EventsWrapper from './eventswrapper';
|
||||||
import { WebpackModules } from './webpackmodules';
|
import { WebpackModules, Filters } from './webpackmodules';
|
||||||
import DiscordApi from './discordapi';
|
import DiscordApi from './discordapi';
|
||||||
import { ReactComponents } from './reactcomponents';
|
import { ReactComponents } from './reactcomponents';
|
||||||
import { Patcher, MonkeyPatch } from './patcher';
|
import { Patcher, MonkeyPatch } from './patcher';
|
||||||
|
@ -437,21 +437,30 @@ export default class PluginApi {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filters
|
||||||
|
*/
|
||||||
|
|
||||||
|
get Filters() { return Filters }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DiscordApi
|
* DiscordApi
|
||||||
*/
|
*/
|
||||||
|
|
||||||
get Discord() {
|
get Discord() { return DiscordApi }
|
||||||
return DiscordApi;
|
get DiscordApi() { return DiscordApi }
|
||||||
}
|
|
||||||
|
|
||||||
get ReactComponents() {
|
/**
|
||||||
return ReactComponents;
|
* ReactComponents
|
||||||
}
|
*/
|
||||||
|
|
||||||
get Reflection() {
|
get ReactComponents() { return ReactComponents }
|
||||||
return Reflection;
|
|
||||||
}
|
/**
|
||||||
|
* Reflection
|
||||||
|
*/
|
||||||
|
|
||||||
|
get Reflection() { return Reflection }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Patcher
|
* Patcher
|
||||||
|
|
|
@ -159,8 +159,8 @@ export default function (node) {
|
||||||
getComponentByPrototypes(props, selector) {
|
getComponentByPrototypes(props, selector) {
|
||||||
return Reflection.findComponent(this.node, Filters.byPrototypeFields(props, selector));
|
return Reflection.findComponent(this.node, Filters.byPrototypeFields(props, selector));
|
||||||
}
|
}
|
||||||
getComponentByRegex(filter) {
|
getComponentByRegex(regex, selector) {
|
||||||
return Reflection.findComponent(this.node, Filters.byCode(displayName));
|
return Reflection.findComponent(this.node, Filters.byCode(regex, selector));
|
||||||
}
|
}
|
||||||
getComponentByDisplayName(name) {
|
getComponentByDisplayName(name) {
|
||||||
return Reflection.findComponent(this.node, Filters.byDisplayName(name));
|
return Reflection.findComponent(this.node, Filters.byDisplayName(name));
|
||||||
|
|
Loading…
Reference in New Issue