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 Events from './events';
|
||||
import EventsWrapper from './eventswrapper';
|
||||
import { WebpackModules } from './webpackmodules';
|
||||
import { WebpackModules, Filters } from './webpackmodules';
|
||||
import DiscordApi from './discordapi';
|
||||
import { ReactComponents } from './reactcomponents';
|
||||
import { Patcher, MonkeyPatch } from './patcher';
|
||||
|
@ -437,21 +437,30 @@ export default class PluginApi {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters
|
||||
*/
|
||||
|
||||
get Filters() { return Filters }
|
||||
|
||||
/**
|
||||
* DiscordApi
|
||||
*/
|
||||
|
||||
get Discord() {
|
||||
return DiscordApi;
|
||||
}
|
||||
get Discord() { return DiscordApi }
|
||||
get DiscordApi() { return DiscordApi }
|
||||
|
||||
get ReactComponents() {
|
||||
return ReactComponents;
|
||||
}
|
||||
/**
|
||||
* ReactComponents
|
||||
*/
|
||||
|
||||
get Reflection() {
|
||||
return Reflection;
|
||||
}
|
||||
get ReactComponents() { return ReactComponents }
|
||||
|
||||
/**
|
||||
* Reflection
|
||||
*/
|
||||
|
||||
get Reflection() { return Reflection }
|
||||
|
||||
/**
|
||||
* Patcher
|
||||
|
|
|
@ -159,8 +159,8 @@ export default function (node) {
|
|||
getComponentByPrototypes(props, selector) {
|
||||
return Reflection.findComponent(this.node, Filters.byPrototypeFields(props, selector));
|
||||
}
|
||||
getComponentByRegex(filter) {
|
||||
return Reflection.findComponent(this.node, Filters.byCode(displayName));
|
||||
getComponentByRegex(regex, selector) {
|
||||
return Reflection.findComponent(this.node, Filters.byCode(regex, selector));
|
||||
}
|
||||
getComponentByDisplayName(name) {
|
||||
return Reflection.findComponent(this.node, Filters.byDisplayName(name));
|
||||
|
|
Loading…
Reference in New Issue