Redux.jsm 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691
  1. /**
  2. * Redux v.4.0.1
  3. *
  4. * This file was imported from https://unpkg.com/redux@4.0.1/dist/redux.js
  5. * and reformatted as a Javascript Core Module
  6. */
  7. var EXPORTED_SYMBOLS = ["redux"];
  8. var self = this;
  9. this.redux = (function (global, factory) {
  10. var exports = {};
  11. factory(exports);
  12. return exports;
  13. }(this, (function (exports) { 'use strict';
  14. function symbolObservablePonyfill(root) {
  15. var result;
  16. var Symbol = root.Symbol;
  17. if (typeof Symbol === 'function') {
  18. if (Symbol.observable) {
  19. result = Symbol.observable;
  20. } else {
  21. result = Symbol('observable');
  22. Symbol.observable = result;
  23. }
  24. } else {
  25. result = '@@observable';
  26. }
  27. return result;
  28. }
  29. /* global window */
  30. // This is edited to prevent Function being present in this code.
  31. // See https://bugzilla.mozilla.org/show_bug.cgi?id=1486375
  32. var root;
  33. if (typeof self !== 'undefined') {
  34. root = self;
  35. } else if (typeof global !== 'undefined') {
  36. root = global;
  37. }
  38. var result = symbolObservablePonyfill(root);
  39. /**
  40. * These are private action types reserved by Redux.
  41. * For any unknown actions, you must return the current state.
  42. * If the current state is undefined, you must return the initial state.
  43. * Do not reference these action types directly in your code.
  44. */
  45. var randomString = function randomString() {
  46. return Math.random().toString(36).substring(7).split('').join('.');
  47. };
  48. var ActionTypes = {
  49. INIT: "@@redux/INIT" + randomString(),
  50. REPLACE: "@@redux/REPLACE" + randomString(),
  51. PROBE_UNKNOWN_ACTION: function PROBE_UNKNOWN_ACTION() {
  52. return "@@redux/PROBE_UNKNOWN_ACTION" + randomString();
  53. }
  54. };
  55. /**
  56. * @param {any} obj The object to inspect.
  57. * @returns {boolean} True if the argument appears to be a plain object.
  58. */
  59. function isPlainObject(obj) {
  60. if (typeof obj !== 'object' || obj === null) return false;
  61. var proto = obj;
  62. while (Object.getPrototypeOf(proto) !== null) {
  63. proto = Object.getPrototypeOf(proto);
  64. }
  65. return Object.getPrototypeOf(obj) === proto;
  66. }
  67. /**
  68. * Creates a Redux store that holds the state tree.
  69. * The only way to change the data in the store is to call `dispatch()` on it.
  70. *
  71. * There should only be a single store in your app. To specify how different
  72. * parts of the state tree respond to actions, you may combine several reducers
  73. * into a single reducer function by using `combineReducers`.
  74. *
  75. * @param {Function} reducer A function that returns the next state tree, given
  76. * the current state tree and the action to handle.
  77. *
  78. * @param {any} [preloadedState] The initial state. You may optionally specify it
  79. * to hydrate the state from the server in universal apps, or to restore a
  80. * previously serialized user session.
  81. * If you use `combineReducers` to produce the root reducer function, this must be
  82. * an object with the same shape as `combineReducers` keys.
  83. *
  84. * @param {Function} [enhancer] The store enhancer. You may optionally specify it
  85. * to enhance the store with third-party capabilities such as middleware,
  86. * time travel, persistence, etc. The only store enhancer that ships with Redux
  87. * is `applyMiddleware()`.
  88. *
  89. * @returns {Store} A Redux store that lets you read the state, dispatch actions
  90. * and subscribe to changes.
  91. */
  92. function createStore(reducer, preloadedState, enhancer) {
  93. var _ref2;
  94. if (typeof preloadedState === 'function' && typeof enhancer === 'function' || typeof enhancer === 'function' && typeof arguments[3] === 'function') {
  95. throw new Error('It looks like you are passing several store enhancers to ' + 'createStore(). This is not supported. Instead, compose them ' + 'together to a single function');
  96. }
  97. if (typeof preloadedState === 'function' && typeof enhancer === 'undefined') {
  98. enhancer = preloadedState;
  99. preloadedState = undefined;
  100. }
  101. if (typeof enhancer !== 'undefined') {
  102. if (typeof enhancer !== 'function') {
  103. throw new Error('Expected the enhancer to be a function.');
  104. }
  105. return enhancer(createStore)(reducer, preloadedState);
  106. }
  107. if (typeof reducer !== 'function') {
  108. throw new Error('Expected the reducer to be a function.');
  109. }
  110. var currentReducer = reducer;
  111. var currentState = preloadedState;
  112. var currentListeners = [];
  113. var nextListeners = currentListeners;
  114. var isDispatching = false;
  115. function ensureCanMutateNextListeners() {
  116. if (nextListeners === currentListeners) {
  117. nextListeners = currentListeners.slice();
  118. }
  119. }
  120. /**
  121. * Reads the state tree managed by the store.
  122. *
  123. * @returns {any} The current state tree of your application.
  124. */
  125. function getState() {
  126. if (isDispatching) {
  127. throw new Error('You may not call store.getState() while the reducer is executing. ' + 'The reducer has already received the state as an argument. ' + 'Pass it down from the top reducer instead of reading it from the store.');
  128. }
  129. return currentState;
  130. }
  131. /**
  132. * Adds a change listener. It will be called any time an action is dispatched,
  133. * and some part of the state tree may potentially have changed. You may then
  134. * call `getState()` to read the current state tree inside the callback.
  135. *
  136. * You may call `dispatch()` from a change listener, with the following
  137. * caveats:
  138. *
  139. * 1. The subscriptions are snapshotted just before every `dispatch()` call.
  140. * If you subscribe or unsubscribe while the listeners are being invoked, this
  141. * will not have any effect on the `dispatch()` that is currently in progress.
  142. * However, the next `dispatch()` call, whether nested or not, will use a more
  143. * recent snapshot of the subscription list.
  144. *
  145. * 2. The listener should not expect to see all state changes, as the state
  146. * might have been updated multiple times during a nested `dispatch()` before
  147. * the listener is called. It is, however, guaranteed that all subscribers
  148. * registered before the `dispatch()` started will be called with the latest
  149. * state by the time it exits.
  150. *
  151. * @param {Function} listener A callback to be invoked on every dispatch.
  152. * @returns {Function} A function to remove this change listener.
  153. */
  154. function subscribe(listener) {
  155. if (typeof listener !== 'function') {
  156. throw new Error('Expected the listener to be a function.');
  157. }
  158. if (isDispatching) {
  159. throw new Error('You may not call store.subscribe() while the reducer is executing. ' + 'If you would like to be notified after the store has been updated, subscribe from a ' + 'component and invoke store.getState() in the callback to access the latest state. ' + 'See https://redux.js.org/api-reference/store#subscribe(listener) for more details.');
  160. }
  161. var isSubscribed = true;
  162. ensureCanMutateNextListeners();
  163. nextListeners.push(listener);
  164. return function unsubscribe() {
  165. if (!isSubscribed) {
  166. return;
  167. }
  168. if (isDispatching) {
  169. throw new Error('You may not unsubscribe from a store listener while the reducer is executing. ' + 'See https://redux.js.org/api-reference/store#subscribe(listener) for more details.');
  170. }
  171. isSubscribed = false;
  172. ensureCanMutateNextListeners();
  173. var index = nextListeners.indexOf(listener);
  174. nextListeners.splice(index, 1);
  175. };
  176. }
  177. /**
  178. * Dispatches an action. It is the only way to trigger a state change.
  179. *
  180. * The `reducer` function, used to create the store, will be called with the
  181. * current state tree and the given `action`. Its return value will
  182. * be considered the **next** state of the tree, and the change listeners
  183. * will be notified.
  184. *
  185. * The base implementation only supports plain object actions. If you want to
  186. * dispatch a Promise, an Observable, a thunk, or something else, you need to
  187. * wrap your store creating function into the corresponding middleware. For
  188. * example, see the documentation for the `redux-thunk` package. Even the
  189. * middleware will eventually dispatch plain object actions using this method.
  190. *
  191. * @param {Object} action A plain object representing “what changed”. It is
  192. * a good idea to keep actions serializable so you can record and replay user
  193. * sessions, or use the time travelling `redux-devtools`. An action must have
  194. * a `type` property which may not be `undefined`. It is a good idea to use
  195. * string constants for action types.
  196. *
  197. * @returns {Object} For convenience, the same action object you dispatched.
  198. *
  199. * Note that, if you use a custom middleware, it may wrap `dispatch()` to
  200. * return something else (for example, a Promise you can await).
  201. */
  202. function dispatch(action) {
  203. if (!isPlainObject(action)) {
  204. throw new Error('Actions must be plain objects. ' + 'Use custom middleware for async actions.');
  205. }
  206. if (typeof action.type === 'undefined') {
  207. throw new Error('Actions may not have an undefined "type" property. ' + 'Have you misspelled a constant?');
  208. }
  209. if (isDispatching) {
  210. throw new Error('Reducers may not dispatch actions.');
  211. }
  212. try {
  213. isDispatching = true;
  214. currentState = currentReducer(currentState, action);
  215. } finally {
  216. isDispatching = false;
  217. }
  218. var listeners = currentListeners = nextListeners;
  219. for (var i = 0; i < listeners.length; i++) {
  220. var listener = listeners[i];
  221. listener();
  222. }
  223. return action;
  224. }
  225. /**
  226. * Replaces the reducer currently used by the store to calculate the state.
  227. *
  228. * You might need this if your app implements code splitting and you want to
  229. * load some of the reducers dynamically. You might also need this if you
  230. * implement a hot reloading mechanism for Redux.
  231. *
  232. * @param {Function} nextReducer The reducer for the store to use instead.
  233. * @returns {void}
  234. */
  235. function replaceReducer(nextReducer) {
  236. if (typeof nextReducer !== 'function') {
  237. throw new Error('Expected the nextReducer to be a function.');
  238. }
  239. currentReducer = nextReducer;
  240. dispatch({
  241. type: ActionTypes.REPLACE
  242. });
  243. }
  244. /**
  245. * Interoperability point for observable/reactive libraries.
  246. * @returns {observable} A minimal observable of state changes.
  247. * For more information, see the observable proposal:
  248. * https://github.com/tc39/proposal-observable
  249. */
  250. function observable() {
  251. var _ref;
  252. var outerSubscribe = subscribe;
  253. return _ref = {
  254. /**
  255. * The minimal observable subscription method.
  256. * @param {Object} observer Any object that can be used as an observer.
  257. * The observer object should have a `next` method.
  258. * @returns {subscription} An object with an `unsubscribe` method that can
  259. * be used to unsubscribe the observable from the store, and prevent further
  260. * emission of values from the observable.
  261. */
  262. subscribe: function subscribe(observer) {
  263. if (typeof observer !== 'object' || observer === null) {
  264. throw new TypeError('Expected the observer to be an object.');
  265. }
  266. function observeState() {
  267. if (observer.next) {
  268. observer.next(getState());
  269. }
  270. }
  271. observeState();
  272. var unsubscribe = outerSubscribe(observeState);
  273. return {
  274. unsubscribe: unsubscribe
  275. };
  276. }
  277. }, _ref[result] = function () {
  278. return this;
  279. }, _ref;
  280. } // When a store is created, an "INIT" action is dispatched so that every
  281. // reducer returns their initial state. This effectively populates
  282. // the initial state tree.
  283. dispatch({
  284. type: ActionTypes.INIT
  285. });
  286. return _ref2 = {
  287. dispatch: dispatch,
  288. subscribe: subscribe,
  289. getState: getState,
  290. replaceReducer: replaceReducer
  291. }, _ref2[result] = observable, _ref2;
  292. }
  293. /**
  294. * Prints a warning in the console if it exists.
  295. *
  296. * @param {String} message The warning message.
  297. * @returns {void}
  298. */
  299. function warning(message) {
  300. /* eslint-disable no-console */
  301. if (typeof console !== 'undefined' && typeof console.error === 'function') {
  302. console.error(message);
  303. }
  304. /* eslint-enable no-console */
  305. try {
  306. // This error was thrown as a convenience so that if you enable
  307. // "break on all exceptions" in your console,
  308. // it would pause the execution at this line.
  309. throw new Error(message);
  310. } catch (e) {} // eslint-disable-line no-empty
  311. }
  312. function getUndefinedStateErrorMessage(key, action) {
  313. var actionType = action && action.type;
  314. var actionDescription = actionType && "action \"" + String(actionType) + "\"" || 'an action';
  315. return "Given " + actionDescription + ", reducer \"" + key + "\" returned undefined. " + "To ignore an action, you must explicitly return the previous state. " + "If you want this reducer to hold no value, you can return null instead of undefined.";
  316. }
  317. function getUnexpectedStateShapeWarningMessage(inputState, reducers, action, unexpectedKeyCache) {
  318. var reducerKeys = Object.keys(reducers);
  319. var argumentName = action && action.type === ActionTypes.INIT ? 'preloadedState argument passed to createStore' : 'previous state received by the reducer';
  320. if (reducerKeys.length === 0) {
  321. return 'Store does not have a valid reducer. Make sure the argument passed ' + 'to combineReducers is an object whose values are reducers.';
  322. }
  323. if (!isPlainObject(inputState)) {
  324. return "The " + argumentName + " has unexpected type of \"" + {}.toString.call(inputState).match(/\s([a-z|A-Z]+)/)[1] + "\". Expected argument to be an object with the following " + ("keys: \"" + reducerKeys.join('", "') + "\"");
  325. }
  326. var unexpectedKeys = Object.keys(inputState).filter(function (key) {
  327. return !reducers.hasOwnProperty(key) && !unexpectedKeyCache[key];
  328. });
  329. unexpectedKeys.forEach(function (key) {
  330. unexpectedKeyCache[key] = true;
  331. });
  332. if (action && action.type === ActionTypes.REPLACE) return;
  333. if (unexpectedKeys.length > 0) {
  334. return "Unexpected " + (unexpectedKeys.length > 1 ? 'keys' : 'key') + " " + ("\"" + unexpectedKeys.join('", "') + "\" found in " + argumentName + ". ") + "Expected to find one of the known reducer keys instead: " + ("\"" + reducerKeys.join('", "') + "\". Unexpected keys will be ignored.");
  335. }
  336. }
  337. function assertReducerShape(reducers) {
  338. Object.keys(reducers).forEach(function (key) {
  339. var reducer = reducers[key];
  340. var initialState = reducer(undefined, {
  341. type: ActionTypes.INIT
  342. });
  343. if (typeof initialState === 'undefined') {
  344. throw new Error("Reducer \"" + key + "\" returned undefined during initialization. " + "If the state passed to the reducer is undefined, you must " + "explicitly return the initial state. The initial state may " + "not be undefined. If you don't want to set a value for this reducer, " + "you can use null instead of undefined.");
  345. }
  346. if (typeof reducer(undefined, {
  347. type: ActionTypes.PROBE_UNKNOWN_ACTION()
  348. }) === 'undefined') {
  349. throw new Error("Reducer \"" + key + "\" returned undefined when probed with a random type. " + ("Don't try to handle " + ActionTypes.INIT + " or other actions in \"redux/*\" ") + "namespace. They are considered private. Instead, you must return the " + "current state for any unknown actions, unless it is undefined, " + "in which case you must return the initial state, regardless of the " + "action type. The initial state may not be undefined, but can be null.");
  350. }
  351. });
  352. }
  353. /**
  354. * Turns an object whose values are different reducer functions, into a single
  355. * reducer function. It will call every child reducer, and gather their results
  356. * into a single state object, whose keys correspond to the keys of the passed
  357. * reducer functions.
  358. *
  359. * @param {Object} reducers An object whose values correspond to different
  360. * reducer functions that need to be combined into one. One handy way to obtain
  361. * it is to use ES6 `import * as reducers` syntax. The reducers may never return
  362. * undefined for any action. Instead, they should return their initial state
  363. * if the state passed to them was undefined, and the current state for any
  364. * unrecognized action.
  365. *
  366. * @returns {Function} A reducer function that invokes every reducer inside the
  367. * passed object, and builds a state object with the same shape.
  368. */
  369. function combineReducers(reducers) {
  370. var reducerKeys = Object.keys(reducers);
  371. var finalReducers = {};
  372. for (var i = 0; i < reducerKeys.length; i++) {
  373. var key = reducerKeys[i];
  374. {
  375. if (typeof reducers[key] === 'undefined') {
  376. warning("No reducer provided for key \"" + key + "\"");
  377. }
  378. }
  379. if (typeof reducers[key] === 'function') {
  380. finalReducers[key] = reducers[key];
  381. }
  382. }
  383. var finalReducerKeys = Object.keys(finalReducers);
  384. var unexpectedKeyCache;
  385. {
  386. unexpectedKeyCache = {};
  387. }
  388. var shapeAssertionError;
  389. try {
  390. assertReducerShape(finalReducers);
  391. } catch (e) {
  392. shapeAssertionError = e;
  393. }
  394. return function combination(state, action) {
  395. if (state === void 0) {
  396. state = {};
  397. }
  398. if (shapeAssertionError) {
  399. throw shapeAssertionError;
  400. }
  401. {
  402. var warningMessage = getUnexpectedStateShapeWarningMessage(state, finalReducers, action, unexpectedKeyCache);
  403. if (warningMessage) {
  404. warning(warningMessage);
  405. }
  406. }
  407. var hasChanged = false;
  408. var nextState = {};
  409. for (var _i = 0; _i < finalReducerKeys.length; _i++) {
  410. var _key = finalReducerKeys[_i];
  411. var reducer = finalReducers[_key];
  412. var previousStateForKey = state[_key];
  413. var nextStateForKey = reducer(previousStateForKey, action);
  414. if (typeof nextStateForKey === 'undefined') {
  415. var errorMessage = getUndefinedStateErrorMessage(_key, action);
  416. throw new Error(errorMessage);
  417. }
  418. nextState[_key] = nextStateForKey;
  419. hasChanged = hasChanged || nextStateForKey !== previousStateForKey;
  420. }
  421. return hasChanged ? nextState : state;
  422. };
  423. }
  424. function bindActionCreator(actionCreator, dispatch) {
  425. return function () {
  426. return dispatch(actionCreator.apply(this, arguments));
  427. };
  428. }
  429. /**
  430. * Turns an object whose values are action creators, into an object with the
  431. * same keys, but with every function wrapped into a `dispatch` call so they
  432. * may be invoked directly. This is just a convenience method, as you can call
  433. * `store.dispatch(MyActionCreators.doSomething())` yourself just fine.
  434. *
  435. * For convenience, you can also pass a single function as the first argument,
  436. * and get a function in return.
  437. *
  438. * @param {Function|Object} actionCreators An object whose values are action
  439. * creator functions. One handy way to obtain it is to use ES6 `import * as`
  440. * syntax. You may also pass a single function.
  441. *
  442. * @param {Function} dispatch The `dispatch` function available on your Redux
  443. * store.
  444. *
  445. * @returns {Function|Object} The object mimicking the original object, but with
  446. * every action creator wrapped into the `dispatch` call. If you passed a
  447. * function as `actionCreators`, the return value will also be a single
  448. * function.
  449. */
  450. function bindActionCreators(actionCreators, dispatch) {
  451. if (typeof actionCreators === 'function') {
  452. return bindActionCreator(actionCreators, dispatch);
  453. }
  454. if (typeof actionCreators !== 'object' || actionCreators === null) {
  455. throw new Error("bindActionCreators expected an object or a function, instead received " + (actionCreators === null ? 'null' : typeof actionCreators) + ". " + "Did you write \"import ActionCreators from\" instead of \"import * as ActionCreators from\"?");
  456. }
  457. var keys = Object.keys(actionCreators);
  458. var boundActionCreators = {};
  459. for (var i = 0; i < keys.length; i++) {
  460. var key = keys[i];
  461. var actionCreator = actionCreators[key];
  462. if (typeof actionCreator === 'function') {
  463. boundActionCreators[key] = bindActionCreator(actionCreator, dispatch);
  464. }
  465. }
  466. return boundActionCreators;
  467. }
  468. function _defineProperty(obj, key, value) {
  469. if (key in obj) {
  470. Object.defineProperty(obj, key, {
  471. value: value,
  472. enumerable: true,
  473. configurable: true,
  474. writable: true
  475. });
  476. } else {
  477. obj[key] = value;
  478. }
  479. return obj;
  480. }
  481. function _objectSpread(target) {
  482. for (var i = 1; i < arguments.length; i++) {
  483. var source = arguments[i] != null ? arguments[i] : {};
  484. var ownKeys = Object.keys(source);
  485. if (typeof Object.getOwnPropertySymbols === 'function') {
  486. ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
  487. return Object.getOwnPropertyDescriptor(source, sym).enumerable;
  488. }));
  489. }
  490. ownKeys.forEach(function (key) {
  491. _defineProperty(target, key, source[key]);
  492. });
  493. }
  494. return target;
  495. }
  496. /**
  497. * Composes single-argument functions from right to left. The rightmost
  498. * function can take multiple arguments as it provides the signature for
  499. * the resulting composite function.
  500. *
  501. * @param {...Function} funcs The functions to compose.
  502. * @returns {Function} A function obtained by composing the argument functions
  503. * from right to left. For example, compose(f, g, h) is identical to doing
  504. * (...args) => f(g(h(...args))).
  505. */
  506. function compose() {
  507. for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) {
  508. funcs[_key] = arguments[_key];
  509. }
  510. if (funcs.length === 0) {
  511. return function (arg) {
  512. return arg;
  513. };
  514. }
  515. if (funcs.length === 1) {
  516. return funcs[0];
  517. }
  518. return funcs.reduce(function (a, b) {
  519. return function () {
  520. return a(b.apply(void 0, arguments));
  521. };
  522. });
  523. }
  524. /**
  525. * Creates a store enhancer that applies middleware to the dispatch method
  526. * of the Redux store. This is handy for a variety of tasks, such as expressing
  527. * asynchronous actions in a concise manner, or logging every action payload.
  528. *
  529. * See `redux-thunk` package as an example of the Redux middleware.
  530. *
  531. * Because middleware is potentially asynchronous, this should be the first
  532. * store enhancer in the composition chain.
  533. *
  534. * Note that each middleware will be given the `dispatch` and `getState` functions
  535. * as named arguments.
  536. *
  537. * @param {...Function} middlewares The middleware chain to be applied.
  538. * @returns {Function} A store enhancer applying the middleware.
  539. */
  540. function applyMiddleware() {
  541. for (var _len = arguments.length, middlewares = new Array(_len), _key = 0; _key < _len; _key++) {
  542. middlewares[_key] = arguments[_key];
  543. }
  544. return function (createStore) {
  545. return function () {
  546. var store = createStore.apply(void 0, arguments);
  547. var _dispatch = function dispatch() {
  548. throw new Error("Dispatching while constructing your middleware is not allowed. " + "Other middleware would not be applied to this dispatch.");
  549. };
  550. var middlewareAPI = {
  551. getState: store.getState,
  552. dispatch: function dispatch() {
  553. return _dispatch.apply(void 0, arguments);
  554. }
  555. };
  556. var chain = middlewares.map(function (middleware) {
  557. return middleware(middlewareAPI);
  558. });
  559. _dispatch = compose.apply(void 0, chain)(store.dispatch);
  560. return _objectSpread({}, store, {
  561. dispatch: _dispatch
  562. });
  563. };
  564. };
  565. }
  566. /*
  567. * This is a dummy function to check if the function name has been altered by minification.
  568. * If the function has been minified and NODE_ENV !== 'production', warn the user.
  569. */
  570. function isCrushed() {}
  571. if (typeof isCrushed.name === 'string' && isCrushed.name !== 'isCrushed') {
  572. warning('You are currently using minified code outside of NODE_ENV === "production". ' + 'This means that you are running a slower development build of Redux. ' + 'You can use loose-envify (https://github.com/zertosh/loose-envify) for browserify ' + 'or setting mode to production in webpack (https://webpack.js.org/concepts/mode/) ' + 'to ensure you have the correct code for your production build.');
  573. }
  574. exports.createStore = createStore;
  575. exports.combineReducers = combineReducers;
  576. exports.bindActionCreators = bindActionCreators;
  577. exports.applyMiddleware = applyMiddleware;
  578. exports.compose = compose;
  579. exports.__DO_NOT_USE__ActionTypes = ActionTypes;
  580. Object.defineProperty(exports, '__esModule', { value: true });
  581. })));