mirror of
https://github.com/wassname/talk.git
synced 2026-07-06 05:17:19 +08:00
Rename module to getModule
This commit is contained in:
@@ -8,7 +8,7 @@ import plugins from 'pluginsConfig';
|
||||
* Returns the config object of given plugin.
|
||||
*/
|
||||
function getConfig(plugin) {
|
||||
return plugins.configs.filter(o => o.plugin === plugin)[0].module();
|
||||
return plugins.configs.filter(o => o.plugin === plugin)[0].getModule();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -17,7 +17,7 @@ function getConfig(plugin) {
|
||||
export function getSlotElements(slot, props = {}) {
|
||||
return plugins.components
|
||||
.map((o, i) => ({
|
||||
component: o.module(),
|
||||
component: o.getModule(),
|
||||
props: {...getConfig(o.plugin), ...props, key: i},
|
||||
}))
|
||||
.filter(o => o.props.slot === slot)
|
||||
@@ -26,20 +26,20 @@ export function getSlotElements(slot, props = {}) {
|
||||
|
||||
// Returns a map of redux actions.
|
||||
export function getPluginActions() {
|
||||
return merge(...plugins.actions.map(o => ({...o.module()})));
|
||||
return merge(...plugins.actions.map(o => ({...o.getModule()})));
|
||||
}
|
||||
|
||||
// Returns a map of redux reducers.
|
||||
export function getPluginReducers() {
|
||||
merge(...plugins.reducers.map(o => ({...o.module()})));
|
||||
merge(...plugins.reducers.map(o => ({...o.getModule()})));
|
||||
}
|
||||
|
||||
// Returns an array of graphQL queries and mutators.
|
||||
export function getPluginQueriesAndMutators() {
|
||||
return flatten(
|
||||
merge(
|
||||
plugins.queries.map(o => values(o.module())),
|
||||
plugins.mutators.map(o => values(o.module())),
|
||||
plugins.queries.map(o => values(o.getModule())),
|
||||
plugins.mutators.map(o => values(o.getModule())),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
*
|
||||
* Outputs a module that looks like the following:
|
||||
*
|
||||
* module.exports.actions = [{plugin: string, module: callback}, ...]
|
||||
* module.exports.reducer = [{plugin: string, module: callback}, ...]
|
||||
* module.exports.actions = [{plugin: string, getModule: callback}, ...]
|
||||
* module.exports.reducer = [{plugin: string, getModule: callback}, ...]
|
||||
* [...]
|
||||
*
|
||||
*/
|
||||
@@ -30,7 +30,7 @@ function moduleExists(loc) {
|
||||
|
||||
function addIfExists(list, plugin, resource) {
|
||||
if (moduleExists(`../../../plugins/${plugin}/client/${resource}`)) {
|
||||
list.push(`{module: () => require('plugins/${plugin}/client/${resource}'), plugin: '${plugin}'}`);
|
||||
list.push(`{getModule: () => require('plugins/${plugin}/client/${resource}'), plugin: '${plugin}'}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user