mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-23 00:45:16 +00:00
20 lines
481 B
JavaScript
20 lines
481 B
JavaScript
|
function createThunkMiddleware(extraArgument) {
|
||
|
return function (_ref) {
|
||
|
var dispatch = _ref.dispatch,
|
||
|
getState = _ref.getState;
|
||
|
return function (next) {
|
||
|
return function (action) {
|
||
|
if (typeof action === 'function') {
|
||
|
return action(dispatch, getState, extraArgument);
|
||
|
}
|
||
|
|
||
|
return next(action);
|
||
|
};
|
||
|
};
|
||
|
};
|
||
|
}
|
||
|
|
||
|
var thunk = createThunkMiddleware();
|
||
|
thunk.withExtraArgument = createThunkMiddleware;
|
||
|
|
||
|
export default thunk;
|