2.2.0 • Published 7 years ago

id-redux-modules v2.2.0

Weekly downloads
3
License
Unlicense
Repository
github
Last release
7 years ago

id-redux-modules

Groups your Redux reducers and routes into modules so you can easily compose them.

Build Status

Installation

npm install --save id-redux-modules

Usage

const Module = require('id-redux-modules').Module

const myModule = new Module({
  name: "MyModule",
  store: myStore,
})

Module

Represents a composable collection of redux parts.

Kind: global class

new Module(options)

Represents a composable collection of redux parts.

ParamTypeDescription
optionsObjectThe options object.
options.nameStringThe name of the module.
options.storeObjectThe Redux store instance.
options.actionsObjectThe Redux actions the module can dispatch.
options.actionCreatorsObjectThe action creators for the actions.
options.componentsObjectThe components the module uses.
options.routesfunctionThe final route component returned from the module.
options.reducersObjectThe reducers of the module. They process the module's actions.
options.submodulesObjectAn array of submodules.

module.name ⇒ String

Returns the name of the module.

Kind: instance property of Module Returns: String - name - The name of the module

module.name ⇒ Undefined

Sets the name of the module.

Kind: instance property of Module

ParamTypeDescription
nameStringThe name of the module.

module.store ⇒ String

Returns the store of the module.

Kind: instance property of Module Returns: String - store - The store of the module

module.store ⇒ Undefined

Sets the store of the module and all it's submodules.

Kind: instance property of Module

ParamTypeDescription
storeObjectThe store.

module.actions ⇒ Object

Returns the actions of the module.

Kind: instance property of Module Returns: Object - actions

module.actions ⇒ undefined

Replaces the actions.

Kind: instance property of Module

ParamTypeDescription
actionsObjectThe new actions.

module.actionCreators ⇒ Object

Returns the actionCreators of the module.

Kind: instance property of Module Returns: Object - actionCreators

module.actionCreators ⇒ Undefined

Replaces the actionCreators.

Kind: instance property of Module

ParamTypeDescription
actionCreatorsObjectThe new actionCreators.

module.components ⇒ Object

Returns the components of the module.

Kind: instance property of Module Returns: Object - components

module.components ⇒ Undefined

Replaces the components.

Kind: instance property of Module

ParamTypeDescription
componentsObjectThe new components.

module.routes ⇒ Object

Calls the modules' routes function and composes it with the routes of the submodules, creating one route tree.

Kind: instance property of Module Returns: Object - Routes

module.routes ⇒ Undefined

Replaces the routes.

Kind: instance property of Module

ParamTypeDescription
routesfunctionThe routes function. Returns a React Element.

module.reducers ⇒ Object

Returns the reducers of the module combined with the reducers of the submodules.

Kind: instance property of Module Returns: Object - actions

module.reducers ⇒ Undefined

Replaces the reducers.

Kind: instance property of Module

ParamTypeDescription
reducersObjectThe new reducers.

module.submodules ⇒ Array

Returns the submodules of the module.

Kind: instance property of Module Returns: Array - submodules

module.submodules ⇒ Undefined

Replaces the submodules.

Kind: instance property of Module

ParamTypeDescription
submodulesArrayThe new submodules.

module.addAction(name) ⇒ undefined

Adds an action to the module.

Kind: instance method of Module

ParamTypeDescription
nameStringThe name of the action.

module.removeAction(name) ⇒ undefined

Removes an action from the module.

Kind: instance method of Module

ParamTypeDescription
nameStringThe name of the action.

module.addActionCreator(name, actionCreator) ⇒ undefined

Adds an actionCreator to the module.

Kind: instance method of Module

ParamTypeDescription
nameStringThe name of the actionCreator.
actionCreatorfunctionThe actionCreator function.

module.removeActionCreator(name) ⇒ Undefined

Removes an actionCreator from the module.

Kind: instance method of Module

ParamTypeDescription
nameStringThe name of the actionCreator.

module.addReducer(name, reducer) ⇒ Undefined

Adds a reducer to the module.

Kind: instance method of Module

ParamTypeDescription
nameStringThe name of the reducer.
reducerfunctionThe reducer function.

module.removeReducer(name) ⇒ Undefined

Removes a reducer from the module.

Kind: instance method of Module

ParamTypeDescription
nameStringThe name of the reducer.

module.addSubmodule(options) ⇒ Undefined

Adds a submodule to the module.

Kind: instance method of Module

ParamTypeDescription
optionsObjectThe options for the submodule.

module.removeSubmodule(submodule) ⇒ Undefined

Removes a submodule from the module.

Kind: instance method of Module

ParamTypeDescription
submoduleObjectThe options for the submodule.
2.2.0

7 years ago

2.1.0

7 years ago

2.0.0

7 years ago