Function
Static Public Summary | ||
public |
bindRequestActions(actions: Object, dispatch: Function): Object Takes an object with keys as function names and values of action factory slices |
|
public |
catchAction(actionSlice: Object, context: Object): Observable Appends a catch to a call for handling |
|
public |
Ensures that all payloads in actions are in the form of objects |
|
public |
createActionFactory(factoryName: String): Function Creates an Action Factory |
|
public |
createActionTypeFactory(factoryName: String, factorySlice: String, actionTypes: Object, requestPayloadCreator: Function): Function Creates an ActionSlice |
|
public |
failure(actionSlice: Object, context: Object): ActionCreator Action creator for FAILURE type actions |
|
public |
failureObs(actionSlice: Object, context: Object): Observable Appends a catch to a call for handling |
|
public |
mapAction(actionSlice: Object, context: Object): Observable Wrap data in a this-bound observable to success/failure actions based on observable state
A |
|
public |
Action creator for REQUEST type actions |
|
public |
success(actionSlice: Object, context: Object): ActionCreator Action creator for SUCCESS type actions |
Static Public
public bindRequestActions(actions: Object, dispatch: Function): Object source
import bindRequestActions from 'redux-actioner/src/bind.js'
Takes an object with keys as function names and values of action factory slices
Example:
const mapDispatchToProps = (dispatch) => {
return {
actions: bindRequestActions({
addTodoItem: TodoActions.ADD
}, dispatch);
};
};
public catchAction(actionSlice: Object, context: Object): Observable source
import {catchAction} from 'redux-actioner/src/rxjs.js'
Appends a catch to a call for handling failure
action with the error as payload.
Best used with the this-bind syntax, ie: obs::action(LOAD_TODOS)
public complianceMiddleware(): Function source
import {complianceMiddleware} from 'redux-actioner/src/compliance.js'
Ensures that all payloads in actions are in the form of objects
Example:
import { applyMiddleware, createStore } from 'redux';
const store = createStore(reducers, initialState, applyMiddleware(complianceMiddleware));
public createActionFactory(factoryName: String): Function source
import {createActionFactory} from 'redux-actioner/src/factory.js'
Creates an Action Factory
Params:
Name | Type | Attribute | Description |
factoryName | String | Namespace for a group of Action Slices |
Example:
const createSliceAction = createActionFactory('TODO');
export const ADD = createSliceAction('ADD', ({ text, title, listId: list_id })
=> ({ text, title, list_id }));
public createActionTypeFactory(factoryName: String, factorySlice: String, actionTypes: Object, requestPayloadCreator: Function): Function source
import {createActionTypeFactory} from 'redux-actioner/src/factory.js'
Creates an ActionSlice
Params:
Name | Type | Attribute | Description |
factoryName | String | Namespace for a group of actions |
|
factorySlice | String | Namespace for a specific action slice |
|
actionTypes | Object |
|
For defining action types |
requestPayloadCreator | Function |
|
For transforming request payloads |
public failure(actionSlice: Object, context: Object): ActionCreator source
import {failure} from 'redux-actioner/src/factory.js'
Action creator for FAILURE type actions
Example:
request(TodoActions.ADD, { text: "Do something great." })(new Error("Please add a title..."))
public failureObs(actionSlice: Object, context: Object): Observable source
import {failureObs} from 'redux-actioner/src/rxjs.js'
Appends a catch to a call for handling failure
action with the error as payload.
Best used with the this-bind syntax, ie: obs::action(LOAD_TODOS)
public mapAction(actionSlice: Object, context: Object): Observable source
import {mapAction} from 'redux-actioner/src/rxjs.js'
Wrap data in a this-bound observable to success/failure actions based on observable state
A catch
transformation is run on this observable converting the failed observable to one carrying the failure
action with the error as payload.
Best used with the this-bind syntax, ie: obs::action(LOAD_TODOS)
public request(actionSlice: Object): Function source
import {request} from 'redux-actioner/src/factory.js'
Action creator for REQUEST type actions
Params:
Name | Type | Attribute | Description |
actionSlice | Object | an Action Slice object |
Example:
request(TodoActions.ADD)({ text: "Do something great." })
public success(actionSlice: Object, context: Object): ActionCreator source
import {success} from 'redux-actioner/src/factory.js'
Action creator for SUCCESS type actions
Example:
request(TodoActions.ADD, { text: "Do something great." })({ itemId: 1 })