* Creates a store enhancer that applies middleware to the dispatch method * of the Redux store. This is handy for a variety of tasks, such as expressing * asynchronous actions in a concise manner, or logging every action payload. * * See `redux-thunk` package as an example of the Redux middlewar
()
| 21143 | * @returns {Function} A store enhancer applying the middleware. |
| 21144 | */ |
| 21145 | function applyMiddleware() { |
| 21146 | for (var _len = arguments.length, middlewares = Array(_len), _key = 0; _key < _len; _key++) { |
| 21147 | middlewares[_key] = arguments[_key]; |
| 21148 | } |
| 21149 | |
| 21150 | return function (createStore) { |
| 21151 | return function (reducer, preloadedState, enhancer) { |
| 21152 | var store = createStore(reducer, preloadedState, enhancer); |
| 21153 | var _dispatch = store.dispatch; |
| 21154 | var chain = []; |
| 21155 | |
| 21156 | var middlewareAPI = { |
| 21157 | getState: store.getState, |
| 21158 | dispatch: function dispatch(action) { |
| 21159 | return _dispatch(action); |
| 21160 | } |
| 21161 | }; |
| 21162 | chain = middlewares.map(function (middleware) { |
| 21163 | return middleware(middlewareAPI); |
| 21164 | }); |
| 21165 | _dispatch = _compose2['default'].apply(undefined, chain)(store.dispatch); |
| 21166 | |
| 21167 | return _extends({}, store, { |
| 21168 | dispatch: _dispatch |
| 21169 | }); |
| 21170 | }; |
| 21171 | }; |
| 21172 | } |
| 21173 | },{"./compose":58}],56:[function(require,module,exports){ |
| 21174 | 'use strict'; |
| 21175 |
nothing calls this directly
no test coverage detected