File tree 3 files changed +6
-8
lines changed
3 files changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -7,19 +7,19 @@ export function increment() {
7
7
}
8
8
9
9
export function incrementIfOdd ( ) {
10
- return ( dispatch , { counter } ) => {
10
+ return ( perform , { counter } ) => {
11
11
if ( counter % 2 === 0 ) {
12
12
return ;
13
13
}
14
14
15
- dispatch ( increment ( ) ) ;
15
+ perform ( increment ( ) ) ;
16
16
} ;
17
17
}
18
18
19
19
export function incrementAsync ( ) {
20
- return dispatch => {
20
+ return perform => {
21
21
setTimeout ( ( ) => {
22
- dispatch ( increment ( ) ) ;
22
+ perform ( increment ( ) ) ;
23
23
} , 1000 ) ;
24
24
} ;
25
25
}
Original file line number Diff line number Diff line change @@ -26,9 +26,7 @@ export default class Dispatcher {
26
26
this . setAtom ( nextAtom ) ;
27
27
}
28
28
29
- perform ( actionCreator , ...args ) {
30
- const action = actionCreator ( ...args ) ;
31
-
29
+ perform ( action ) {
32
30
return typeof action === 'function'
33
31
? action ( this . dispatch , this . atom )
34
32
: this . dispatch ( action ) ;
Original file line number Diff line number Diff line change @@ -2,6 +2,6 @@ import mapValues from 'lodash/object/mapValues';
2
2
3
3
export default function bindActions ( actionCreators , dispatcher ) {
4
4
return mapValues ( actionCreators , actionCreator =>
5
- ( ...args ) => dispatcher . perform ( actionCreator , ...args )
5
+ ( ...args ) => dispatcher . perform ( actionCreator ( ...args ) )
6
6
) ;
7
7
}
You can’t perform that action at this time.
0 commit comments