Skip to content

Commit 50d63f7

Browse files
add some comments
1 parent 0f206d0 commit 50d63f7

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

static/js/util/redux.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,21 @@ export function createActionHelper(dispatch: Dispatch, actionCreator: Function):
1010
return (...args) => dispatch(actionCreator(...args));
1111
}
1212

13+
/*
14+
* returns an array of simple (synchronous) action helpers when passed the
15+
* dispatch function and an array of synchronous action creators
16+
*/
1317
export type ActionHelpers = Array<{[k: string]: (...args: any) => void}>;
1418
export function createSimpleActionHelpers(dispatch: Dispatch, actionList: ActionCreator[]): ActionHelpers {
1519
return actionList.map(actionCreator => (
1620
{ [actionCreator.name]: createActionHelper(dispatch, actionCreator) }
1721
));
1822
}
1923

24+
/*
25+
* returns an array of async action helpers from async action creators (those
26+
* that return a function taking dispatch as an argument)
27+
*/
2028
export type AsyncActionHelpers = Array<{[k: string]: AsyncActionHelper}>;
2129
export function createAsyncActionHelpers(dispatch: Dispatch, actionList: AsyncActionCreator[]): AsyncActionHelpers {
2230
return actionList.map(actionCreator => (

0 commit comments

Comments
 (0)