redux

Redux action tools.

License:
  • Apache-2.0
Source:

Members

(static) isWithTypeField

Infer return type if T is function, return T itself otherwise.

Source:

(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(actionCreatorOrThunk, dispatch)

Binds given action creator or thunk with chosen store's dispatch.

Source:
Parameters:
Name Type Description
actionCreatorOrThunk

any action creator or thunk

dispatch

redux store's dispatch function

Returns:

bound action creator or thunk dispatch

(inner) bindActionCreators(actionCreators, dispatch)

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

Turns an object with action creators or thunks 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(actionType, creator)

Redux action creator definer.

Source:
Parameters:
Name Type Description
actionType

Action type

creator

Optional custom function returning payload.

Returns:

Action creator function.

(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) isACWithPayload()

Type predicate - not exposed red-g's internal.

Source:

(inner) isWithPayload()

Type predicate - does a given action carry payload?

Source:

(inner) isWithTypeField()

Checks for type field presence in a given candidate.

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.

License:
  • Apache-2.0
Source:

Members

(static) isWithTypeField

Infer return type if T is function, return T itself otherwise.

Source:

(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(actionCreatorOrThunk, dispatch)

Binds given action creator or thunk with chosen store's dispatch.

Source:
Parameters:
Name Type Description
actionCreatorOrThunk

any action creator or thunk

dispatch

redux store's dispatch function

Returns:

bound action creator or thunk dispatch

(inner) bindActionCreators(actionCreators, dispatch)

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

Turns an object with action creators or thunks 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(actionType, creator)

Redux action creator definer.

Source:
Parameters:
Name Type Description
actionType

Action type

creator

Optional custom function returning payload.

Returns:

Action creator function.

(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) isACWithPayload()

Type predicate - not exposed red-g's internal.

Source:

(inner) isWithPayload()

Type predicate - does a given action carry payload?

Source:

(inner) isWithTypeField()

Checks for type field presence in a given candidate.

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