redux

Redux action tools.

Author:
  • drmats
License:
  • Apache-2.0
Source:
Author:
  • drmats
License:
  • Apache-2.0
Source:

Members

(inner, constant) payload

Unique, private identifier distinguishing between EmptyAction and PayloadAction (statically and in runtime).

Source:

Methods

(inner) actionCreators(actionEnum, payloadCreators)

Construct action slice for provided action enum. Optionally define action creators with payload. Statically typed.

Source:
Parameters:
Name Type Description
actionEnum

Enum upon which an ActionCreators object is built.

payloadCreators

Optional object with payload creators.

Returns:

ActionCreators object.

(inner) bindActionCreator(actionCreator, dispatch)

Binds given action creator with chosen store's dispatch.

Source:
Parameters:
Name Type Description
actionCreator

any action creator

dispatch

redux store's dispatch function

Returns:

bound action creator

(inner) bindActionCreators(actionCreators, dispatch)

Redux's original bindActionCreators clone with extended Action support (original function assumes dispatch parametrized with redux's AnyAction which is not compatible with Action).

Turns an object with action creators into an object with every action creator wrapped into a dispatch call.

Source:
Parameters:
Name Type Description
actionCreators

Object with action creator functions

dispatch

redux store's dispatch function

Returns:

Object with wrapped action creators

(inner) bindActionCreatorsTree(acTree, dispatch)

Bind whole tree of action creators to the redux's dispatch function.

Source:
Parameters:
Name Type Description
acTree

Object with actionCreators objects

dispatch

redux store's dispatch function

Returns:

Object with wrapped action creators

(inner) createReducer(initState) → {ReduxBoundReducer}

Create clean and readable reducers for redux.

Source:
Parameters:
Name Type Description
initState
Returns:
Type:
ReduxBoundReducer

(inner) defineActionCreator()

Action creator not carrying anything else than just type field.

Source:

(inner) emptyActionCreators(actionEnum)

Construct object whose keys correspond to actionEnum keys and values consists of empty action creators for each type. Conforms to EmptyActionCreators<ActionEnum> interface.

Source:
Parameters:
Name Type Description
actionEnum

Enum upon which an EmptyActionCreators object is built.

Returns:

EmptyActionCreators object.

(inner) isNumberActionType()

Type predicate - is a given action of number type?

Source:

(inner) isStringActionType()

Type predicate - is a given action of string type?

Source:

(inner) isWithPayload()

Type predicate - does a given action carry payload?

Source:

(inner) payloadActionCreators(emptyActionCreators, payloadCreators)

Take empty action creators object based on ActionEnum type (an object with all action creators not carrying anything besides type property) and PayloadCreators object consisting of plain javascript functions taking arguments and returning values.

PayloadCreators object type is constrained to be a subset of ActionEnum type (in the sense of AllowSubset type defined in type/utils.ts).

Create fully typed action creators object with all action creators defined as EmptyActionCreator or PayloadActionCreator.

Source:
Parameters:
Name Type Description
emptyActionCreators

EmptyActionCreators object

payloadCreators

Object with payload creators.

Returns:

ActionCreators object.

(inner) sliceReducer(initState)

Statically typed reducer for a slice of state.

Source:
Parameters:
Name Type Description
initState
Returns:

(builder: (slice: SliceBuildAPI) => void) => ReduxCompatReducer

Redux reducer tools.

Author:
  • drmats
License:
  • Apache-2.0
Source:
Author:
  • drmats
License:
  • Apache-2.0
Source:

Members

(inner, constant) payload

Unique, private identifier distinguishing between EmptyAction and PayloadAction (statically and in runtime).

Source:

Methods

(inner) actionCreators(actionEnum, payloadCreators)

Construct action slice for provided action enum. Optionally define action creators with payload. Statically typed.

Source:
Parameters:
Name Type Description
actionEnum

Enum upon which an ActionCreators object is built.

payloadCreators

Optional object with payload creators.

Returns:

ActionCreators object.

(inner) bindActionCreator(actionCreator, dispatch)

Binds given action creator with chosen store's dispatch.

Source:
Parameters:
Name Type Description
actionCreator

any action creator

dispatch

redux store's dispatch function

Returns:

bound action creator

(inner) bindActionCreators(actionCreators, dispatch)

Redux's original bindActionCreators clone with extended Action support (original function assumes dispatch parametrized with redux's AnyAction which is not compatible with Action).

Turns an object with action creators into an object with every action creator wrapped into a dispatch call.

Source:
Parameters:
Name Type Description
actionCreators

Object with action creator functions

dispatch

redux store's dispatch function

Returns:

Object with wrapped action creators

(inner) bindActionCreatorsTree(acTree, dispatch)

Bind whole tree of action creators to the redux's dispatch function.

Source:
Parameters:
Name Type Description
acTree

Object with actionCreators objects

dispatch

redux store's dispatch function

Returns:

Object with wrapped action creators

(inner) createReducer(initState) → {ReduxBoundReducer}

Create clean and readable reducers for redux.

Source:
Parameters:
Name Type Description
initState
Returns:
Type:
ReduxBoundReducer

(inner) defineActionCreator()

Action creator not carrying anything else than just type field.

Source:

(inner) emptyActionCreators(actionEnum)

Construct object whose keys correspond to actionEnum keys and values consists of empty action creators for each type. Conforms to EmptyActionCreators<ActionEnum> interface.

Source:
Parameters:
Name Type Description
actionEnum

Enum upon which an EmptyActionCreators object is built.

Returns:

EmptyActionCreators object.

(inner) isNumberActionType()

Type predicate - is a given action of number type?

Source:

(inner) isStringActionType()

Type predicate - is a given action of string type?

Source:

(inner) isWithPayload()

Type predicate - does a given action carry payload?

Source:

(inner) payloadActionCreators(emptyActionCreators, payloadCreators)

Take empty action creators object based on ActionEnum type (an object with all action creators not carrying anything besides type property) and PayloadCreators object consisting of plain javascript functions taking arguments and returning values.

PayloadCreators object type is constrained to be a subset of ActionEnum type (in the sense of AllowSubset type defined in type/utils.ts).

Create fully typed action creators object with all action creators defined as EmptyActionCreator or PayloadActionCreator.

Source:
Parameters:
Name Type Description
emptyActionCreators

EmptyActionCreators object

payloadCreators

Object with payload creators.

Returns:

ActionCreators object.

(inner) sliceReducer(initState)

Statically typed reducer for a slice of state.

Source:
Parameters:
Name Type Description
initState
Returns:

(builder: (slice: SliceBuildAPI) => void) => ReduxCompatReducer