Home Manual Reference Source Repository

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 failure action with the error as payload.

public

Ensures that all payloads in actions are in the form of objects

public

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 failure action with the error as payload.

public

mapAction(actionSlice: Object, context: Object): Observable

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.

public

request(actionSlice: Object): Function

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

Params:

NameTypeAttributeDescription
actions Object

to be bound to redux store dispatch

dispatch Function

via redux

Return:

Object

an object containing action creators of REQUEST type

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)

Params:

NameTypeAttributeDescription
actionSlice Object

the Action Slice object

context Object

a Context payload object

Return:

Observable

chain

public complianceMiddleware(): Function source

import {complianceMiddleware} from 'redux-actioner/src/compliance.js'

Ensures that all payloads in actions are in the form of objects

Return:

Function

middleware function

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:

NameTypeAttributeDescription
factoryName String

Namespace for a group of Action Slices

Return:

Function

A factory function for creating Action Slices in the same namespace

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:

NameTypeAttributeDescription
factoryName String

Namespace for a group of actions

factorySlice String

Namespace for a specific action slice

actionTypes Object
  • optional
  • default: ActionType

For defining action types

requestPayloadCreator Function
  • optional
  • default: preparePayload

For transforming request payloads

Return:

Function

An action creator function

public failure(actionSlice: Object, context: Object): ActionCreator source

import {failure} from 'redux-actioner/src/factory.js'

Action creator for FAILURE type actions

Params:

NameTypeAttributeDescription
actionSlice Object

an Action Slice object

context Object

a Context payload object

Return:

ActionCreator

an action creator for a Slices' FAILURE type

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)

Params:

NameTypeAttributeDescription
actionSlice Object

the Action Slice object

context Object

a Context payload object

Return:

Observable

chain

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)

Params:

NameTypeAttributeDescription
actionSlice Object

the Action Slice object

context Object

a Context payload object

Return:

Observable

chain

public request(actionSlice: Object): Function source

import {request} from 'redux-actioner/src/factory.js'

Action creator for REQUEST type actions

Params:

NameTypeAttributeDescription
actionSlice Object

an Action Slice object

Return:

Function

an action creator for a Slice's REQUEST type

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

Params:

NameTypeAttributeDescription
actionSlice Object

an Action Slice object

context Object

a Context payload object

Return:

ActionCreator

an action creator for a Slices' SUCCESS type

Example:

request(TodoActions.ADD, { text: "Do something great." })({ itemId: 1 })