isomorfeus-redux 4.2.0 → 22.9.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +176 -0
- data/lib/app_state.rb +25 -0
- data/lib/isomorfeus/browser_store_api.rb +0 -16
- data/lib/isomorfeus/redux/config.rb +97 -14
- data/lib/isomorfeus/redux/handler.rb +35 -0
- data/lib/isomorfeus/redux/version.rb +5 -0
- data/lib/isomorfeus/redux_imports.rb +14 -0
- data/lib/{redux/reducers.rb → isomorfeus/redux_reducers.rb} +15 -13
- data/lib/isomorfeus-redux.rb +18 -30
- data/lib/local_store.rb +27 -30
- data/lib/redux/store.rb +156 -120
- data/lib/session_store.rb +28 -30
- metadata +24 -247
- data/lib/app_store.rb +0 -42
- data/lib/isomorfeus/core_ext/hash/deep_merge.rb +0 -34
- data/lib/isomorfeus/core_ext/kernel.rb +0 -30
- data/lib/isomorfeus/execution_environment.rb +0 -67
- data/lib/isomorfeus/redux/imports.rb +0 -17
- data/lib/redux/version.rb +0 -3
- data/lib/redux.rb +0 -118
- data/node_modules/.package-lock.json +0 -31
- data/node_modules/@babel/runtime/LICENSE +0 -22
- data/node_modules/@babel/runtime/README.md +0 -19
- data/node_modules/@babel/runtime/helpers/AsyncGenerator.js +0 -99
- data/node_modules/@babel/runtime/helpers/AwaitValue.js +0 -6
- data/node_modules/@babel/runtime/helpers/applyDecoratedDescriptor.js +0 -31
- data/node_modules/@babel/runtime/helpers/arrayLikeToArray.js +0 -12
- data/node_modules/@babel/runtime/helpers/arrayWithHoles.js +0 -6
- data/node_modules/@babel/runtime/helpers/arrayWithoutHoles.js +0 -8
- data/node_modules/@babel/runtime/helpers/assertThisInitialized.js +0 -10
- data/node_modules/@babel/runtime/helpers/asyncGeneratorDelegate.js +0 -57
- data/node_modules/@babel/runtime/helpers/asyncIterator.js +0 -16
- data/node_modules/@babel/runtime/helpers/asyncToGenerator.js +0 -38
- data/node_modules/@babel/runtime/helpers/awaitAsyncGenerator.js +0 -8
- data/node_modules/@babel/runtime/helpers/checkPrivateRedeclaration.js +0 -8
- data/node_modules/@babel/runtime/helpers/classApplyDescriptorDestructureSet.js +0 -23
- data/node_modules/@babel/runtime/helpers/classApplyDescriptorGet.js +0 -10
- data/node_modules/@babel/runtime/helpers/classApplyDescriptorSet.js +0 -14
- data/node_modules/@babel/runtime/helpers/classCallCheck.js +0 -8
- data/node_modules/@babel/runtime/helpers/classCheckPrivateStaticAccess.js +0 -8
- data/node_modules/@babel/runtime/helpers/classCheckPrivateStaticFieldDescriptor.js +0 -8
- data/node_modules/@babel/runtime/helpers/classExtractFieldDescriptor.js +0 -10
- data/node_modules/@babel/runtime/helpers/classNameTDZError.js +0 -6
- data/node_modules/@babel/runtime/helpers/classPrivateFieldDestructureSet.js +0 -11
- data/node_modules/@babel/runtime/helpers/classPrivateFieldGet.js +0 -11
- data/node_modules/@babel/runtime/helpers/classPrivateFieldInitSpec.js +0 -9
- data/node_modules/@babel/runtime/helpers/classPrivateFieldLooseBase.js +0 -10
- data/node_modules/@babel/runtime/helpers/classPrivateFieldLooseKey.js +0 -8
- data/node_modules/@babel/runtime/helpers/classPrivateFieldSet.js +0 -12
- data/node_modules/@babel/runtime/helpers/classPrivateMethodGet.js +0 -10
- data/node_modules/@babel/runtime/helpers/classPrivateMethodInitSpec.js +0 -9
- data/node_modules/@babel/runtime/helpers/classPrivateMethodSet.js +0 -6
- data/node_modules/@babel/runtime/helpers/classStaticPrivateFieldDestructureSet.js +0 -14
- data/node_modules/@babel/runtime/helpers/classStaticPrivateFieldSpecGet.js +0 -14
- data/node_modules/@babel/runtime/helpers/classStaticPrivateFieldSpecSet.js +0 -15
- data/node_modules/@babel/runtime/helpers/classStaticPrivateMethodGet.js +0 -9
- data/node_modules/@babel/runtime/helpers/classStaticPrivateMethodSet.js +0 -6
- data/node_modules/@babel/runtime/helpers/construct.js +0 -26
- data/node_modules/@babel/runtime/helpers/createClass.js +0 -18
- data/node_modules/@babel/runtime/helpers/createForOfIteratorHelper.js +0 -61
- data/node_modules/@babel/runtime/helpers/createForOfIteratorHelperLoose.js +0 -25
- data/node_modules/@babel/runtime/helpers/createSuper.js +0 -25
- data/node_modules/@babel/runtime/helpers/decorate.js +0 -401
- data/node_modules/@babel/runtime/helpers/defaults.js +0 -17
- data/node_modules/@babel/runtime/helpers/defineEnumerableProperties.js +0 -25
- data/node_modules/@babel/runtime/helpers/defineProperty.js +0 -17
- data/node_modules/@babel/runtime/helpers/esm/AsyncGenerator.js +0 -95
- data/node_modules/@babel/runtime/helpers/esm/AwaitValue.js +0 -3
- data/node_modules/@babel/runtime/helpers/esm/applyDecoratedDescriptor.js +0 -28
- data/node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js +0 -9
- data/node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js +0 -3
- data/node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js +0 -4
- data/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js +0 -7
- data/node_modules/@babel/runtime/helpers/esm/asyncGeneratorDelegate.js +0 -54
- data/node_modules/@babel/runtime/helpers/esm/asyncIterator.js +0 -13
- data/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js +0 -35
- data/node_modules/@babel/runtime/helpers/esm/awaitAsyncGenerator.js +0 -4
- data/node_modules/@babel/runtime/helpers/esm/checkPrivateRedeclaration.js +0 -5
- data/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorDestructureSet.js +0 -20
- data/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorGet.js +0 -7
- data/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorSet.js +0 -11
- data/node_modules/@babel/runtime/helpers/esm/classCallCheck.js +0 -5
- data/node_modules/@babel/runtime/helpers/esm/classCheckPrivateStaticAccess.js +0 -5
- data/node_modules/@babel/runtime/helpers/esm/classCheckPrivateStaticFieldDescriptor.js +0 -5
- data/node_modules/@babel/runtime/helpers/esm/classExtractFieldDescriptor.js +0 -7
- data/node_modules/@babel/runtime/helpers/esm/classNameTDZError.js +0 -3
- data/node_modules/@babel/runtime/helpers/esm/classPrivateFieldDestructureSet.js +0 -6
- data/node_modules/@babel/runtime/helpers/esm/classPrivateFieldGet.js +0 -6
- data/node_modules/@babel/runtime/helpers/esm/classPrivateFieldInitSpec.js +0 -5
- data/node_modules/@babel/runtime/helpers/esm/classPrivateFieldLooseBase.js +0 -7
- data/node_modules/@babel/runtime/helpers/esm/classPrivateFieldLooseKey.js +0 -4
- data/node_modules/@babel/runtime/helpers/esm/classPrivateFieldSet.js +0 -7
- data/node_modules/@babel/runtime/helpers/esm/classPrivateMethodGet.js +0 -7
- data/node_modules/@babel/runtime/helpers/esm/classPrivateMethodInitSpec.js +0 -5
- data/node_modules/@babel/runtime/helpers/esm/classPrivateMethodSet.js +0 -3
- data/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldDestructureSet.js +0 -8
- data/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldSpecGet.js +0 -8
- data/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldSpecSet.js +0 -9
- data/node_modules/@babel/runtime/helpers/esm/classStaticPrivateMethodGet.js +0 -5
- data/node_modules/@babel/runtime/helpers/esm/classStaticPrivateMethodSet.js +0 -3
- data/node_modules/@babel/runtime/helpers/esm/construct.js +0 -18
- data/node_modules/@babel/runtime/helpers/esm/createClass.js +0 -15
- data/node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelper.js +0 -57
- data/node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelperLoose.js +0 -21
- data/node_modules/@babel/runtime/helpers/esm/createSuper.js +0 -19
- data/node_modules/@babel/runtime/helpers/esm/decorate.js +0 -396
- data/node_modules/@babel/runtime/helpers/esm/defaults.js +0 -14
- data/node_modules/@babel/runtime/helpers/esm/defineEnumerableProperties.js +0 -22
- data/node_modules/@babel/runtime/helpers/esm/defineProperty.js +0 -14
- data/node_modules/@babel/runtime/helpers/esm/extends.js +0 -17
- data/node_modules/@babel/runtime/helpers/esm/get.js +0 -20
- data/node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js +0 -6
- data/node_modules/@babel/runtime/helpers/esm/inherits.js +0 -15
- data/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js +0 -6
- data/node_modules/@babel/runtime/helpers/esm/initializerDefineProperty.js +0 -9
- data/node_modules/@babel/runtime/helpers/esm/initializerWarningHelper.js +0 -3
- data/node_modules/@babel/runtime/helpers/esm/instanceof.js +0 -7
- data/node_modules/@babel/runtime/helpers/esm/interopRequireDefault.js +0 -5
- data/node_modules/@babel/runtime/helpers/esm/interopRequireWildcard.js +0 -51
- data/node_modules/@babel/runtime/helpers/esm/isNativeFunction.js +0 -3
- data/node_modules/@babel/runtime/helpers/esm/isNativeReflectConstruct.js +0 -12
- data/node_modules/@babel/runtime/helpers/esm/iterableToArray.js +0 -3
- data/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js +0 -29
- data/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimitLoose.js +0 -14
- data/node_modules/@babel/runtime/helpers/esm/jsx.js +0 -46
- data/node_modules/@babel/runtime/helpers/esm/maybeArrayLike.js +0 -9
- data/node_modules/@babel/runtime/helpers/esm/newArrowCheck.js +0 -5
- data/node_modules/@babel/runtime/helpers/esm/nonIterableRest.js +0 -3
- data/node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js +0 -3
- data/node_modules/@babel/runtime/helpers/esm/objectDestructuringEmpty.js +0 -3
- data/node_modules/@babel/runtime/helpers/esm/objectSpread.js +0 -19
- data/node_modules/@babel/runtime/helpers/esm/objectSpread2.js +0 -39
- data/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js +0 -19
- data/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js +0 -14
- data/node_modules/@babel/runtime/helpers/esm/package.json +0 -3
- data/node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js +0 -11
- data/node_modules/@babel/runtime/helpers/esm/readOnlyError.js +0 -3
- data/node_modules/@babel/runtime/helpers/esm/set.js +0 -51
- data/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js +0 -8
- data/node_modules/@babel/runtime/helpers/esm/skipFirstGeneratorNext.js +0 -7
- data/node_modules/@babel/runtime/helpers/esm/slicedToArray.js +0 -7
- data/node_modules/@babel/runtime/helpers/esm/slicedToArrayLoose.js +0 -7
- data/node_modules/@babel/runtime/helpers/esm/superPropBase.js +0 -9
- data/node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteral.js +0 -11
- data/node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteralLoose.js +0 -8
- data/node_modules/@babel/runtime/helpers/esm/tdz.js +0 -3
- data/node_modules/@babel/runtime/helpers/esm/temporalRef.js +0 -5
- data/node_modules/@babel/runtime/helpers/esm/temporalUndefined.js +0 -1
- data/node_modules/@babel/runtime/helpers/esm/toArray.js +0 -7
- data/node_modules/@babel/runtime/helpers/esm/toConsumableArray.js +0 -7
- data/node_modules/@babel/runtime/helpers/esm/toPrimitive.js +0 -13
- data/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js +0 -6
- data/node_modules/@babel/runtime/helpers/esm/typeof.js +0 -15
- data/node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js +0 -9
- data/node_modules/@babel/runtime/helpers/esm/wrapAsyncGenerator.js +0 -6
- data/node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js +0 -37
- data/node_modules/@babel/runtime/helpers/esm/wrapRegExp.js +0 -65
- data/node_modules/@babel/runtime/helpers/esm/writeOnlyError.js +0 -3
- data/node_modules/@babel/runtime/helpers/extends.js +0 -21
- data/node_modules/@babel/runtime/helpers/get.js +0 -27
- data/node_modules/@babel/runtime/helpers/getPrototypeOf.js +0 -10
- data/node_modules/@babel/runtime/helpers/inherits.js +0 -19
- data/node_modules/@babel/runtime/helpers/inheritsLoose.js +0 -10
- data/node_modules/@babel/runtime/helpers/initializerDefineProperty.js +0 -12
- data/node_modules/@babel/runtime/helpers/initializerWarningHelper.js +0 -6
- data/node_modules/@babel/runtime/helpers/instanceof.js +0 -10
- data/node_modules/@babel/runtime/helpers/interopRequireDefault.js +0 -8
- data/node_modules/@babel/runtime/helpers/interopRequireWildcard.js +0 -54
- data/node_modules/@babel/runtime/helpers/isNativeFunction.js +0 -6
- data/node_modules/@babel/runtime/helpers/isNativeReflectConstruct.js +0 -15
- data/node_modules/@babel/runtime/helpers/iterableToArray.js +0 -6
- data/node_modules/@babel/runtime/helpers/iterableToArrayLimit.js +0 -32
- data/node_modules/@babel/runtime/helpers/iterableToArrayLimitLoose.js +0 -17
- data/node_modules/@babel/runtime/helpers/jsx.js +0 -50
- data/node_modules/@babel/runtime/helpers/maybeArrayLike.js +0 -13
- data/node_modules/@babel/runtime/helpers/newArrowCheck.js +0 -8
- data/node_modules/@babel/runtime/helpers/nonIterableRest.js +0 -6
- data/node_modules/@babel/runtime/helpers/nonIterableSpread.js +0 -6
- data/node_modules/@babel/runtime/helpers/objectDestructuringEmpty.js +0 -6
- data/node_modules/@babel/runtime/helpers/objectSpread.js +0 -23
- data/node_modules/@babel/runtime/helpers/objectSpread2.js +0 -42
- data/node_modules/@babel/runtime/helpers/objectWithoutProperties.js +0 -23
- data/node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js +0 -17
- data/node_modules/@babel/runtime/helpers/possibleConstructorReturn.js +0 -16
- data/node_modules/@babel/runtime/helpers/readOnlyError.js +0 -6
- data/node_modules/@babel/runtime/helpers/set.js +0 -55
- data/node_modules/@babel/runtime/helpers/setPrototypeOf.js +0 -12
- data/node_modules/@babel/runtime/helpers/skipFirstGeneratorNext.js +0 -10
- data/node_modules/@babel/runtime/helpers/slicedToArray.js +0 -14
- data/node_modules/@babel/runtime/helpers/slicedToArrayLoose.js +0 -14
- data/node_modules/@babel/runtime/helpers/superPropBase.js +0 -13
- data/node_modules/@babel/runtime/helpers/taggedTemplateLiteral.js +0 -14
- data/node_modules/@babel/runtime/helpers/taggedTemplateLiteralLoose.js +0 -11
- data/node_modules/@babel/runtime/helpers/tdz.js +0 -6
- data/node_modules/@babel/runtime/helpers/temporalRef.js +0 -10
- data/node_modules/@babel/runtime/helpers/temporalUndefined.js +0 -4
- data/node_modules/@babel/runtime/helpers/toArray.js +0 -14
- data/node_modules/@babel/runtime/helpers/toConsumableArray.js +0 -14
- data/node_modules/@babel/runtime/helpers/toPrimitive.js +0 -17
- data/node_modules/@babel/runtime/helpers/toPropertyKey.js +0 -11
- data/node_modules/@babel/runtime/helpers/typeof.js +0 -22
- data/node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js +0 -13
- data/node_modules/@babel/runtime/helpers/wrapAsyncGenerator.js +0 -10
- data/node_modules/@babel/runtime/helpers/wrapNativeSuper.js +0 -45
- data/node_modules/@babel/runtime/helpers/wrapRegExp.js +0 -72
- data/node_modules/@babel/runtime/helpers/writeOnlyError.js +0 -6
- data/node_modules/@babel/runtime/package.json +0 -848
- data/node_modules/@babel/runtime/regenerator/index.js +0 -1
- data/node_modules/redux/LICENSE.md +0 -21
- data/node_modules/redux/README.md +0 -322
- data/node_modules/redux/dist/redux.js +0 -768
- data/node_modules/redux/dist/redux.min.js +0 -1
- data/node_modules/redux/es/redux.js +0 -716
- data/node_modules/redux/es/redux.mjs +0 -1
- data/node_modules/redux/index.d.ts +0 -776
- data/node_modules/redux/lib/redux.js +0 -730
- data/node_modules/redux/package.json +0 -108
- data/node_modules/redux/src/applyMiddleware.js +0 -41
- data/node_modules/redux/src/bindActionCreators.js +0 -52
- data/node_modules/redux/src/combineReducers.js +0 -175
- data/node_modules/redux/src/compose.js +0 -22
- data/node_modules/redux/src/createStore.js +0 -347
- data/node_modules/redux/src/index.js +0 -37
- data/node_modules/redux/src/utils/actionTypes.js +0 -17
- data/node_modules/redux/src/utils/formatProdErrorMessage.js +0 -15
- data/node_modules/redux/src/utils/isPlainObject.js +0 -14
- data/node_modules/redux/src/utils/kindOf.js +0 -70
- data/node_modules/redux/src/utils/symbol-observable.js +0 -3
- data/node_modules/redux/src/utils/warning.js +0 -19
- data/node_modules/regenerator-runtime/LICENSE +0 -21
- data/node_modules/regenerator-runtime/README.md +0 -31
- data/node_modules/regenerator-runtime/package.json +0 -19
- data/node_modules/regenerator-runtime/path.js +0 -11
- data/node_modules/regenerator-runtime/runtime.js +0 -754
- data/package.json +0 -6
@@ -1,768 +0,0 @@
|
|
1
|
-
(function (global, factory) {
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Redux = {}));
|
5
|
-
}(this, (function (exports) { 'use strict';
|
6
|
-
|
7
|
-
// Inlined version of the `symbol-observable` polyfill
|
8
|
-
var $$observable = (function () {
|
9
|
-
return typeof Symbol === 'function' && Symbol.observable || '@@observable';
|
10
|
-
})();
|
11
|
-
|
12
|
-
/**
|
13
|
-
* These are private action types reserved by Redux.
|
14
|
-
* For any unknown actions, you must return the current state.
|
15
|
-
* If the current state is undefined, you must return the initial state.
|
16
|
-
* Do not reference these action types directly in your code.
|
17
|
-
*/
|
18
|
-
var randomString = function randomString() {
|
19
|
-
return Math.random().toString(36).substring(7).split('').join('.');
|
20
|
-
};
|
21
|
-
|
22
|
-
var ActionTypes = {
|
23
|
-
INIT: "@@redux/INIT" + randomString(),
|
24
|
-
REPLACE: "@@redux/REPLACE" + randomString(),
|
25
|
-
PROBE_UNKNOWN_ACTION: function PROBE_UNKNOWN_ACTION() {
|
26
|
-
return "@@redux/PROBE_UNKNOWN_ACTION" + randomString();
|
27
|
-
}
|
28
|
-
};
|
29
|
-
|
30
|
-
/**
|
31
|
-
* @param {any} obj The object to inspect.
|
32
|
-
* @returns {boolean} True if the argument appears to be a plain object.
|
33
|
-
*/
|
34
|
-
function isPlainObject(obj) {
|
35
|
-
if (typeof obj !== 'object' || obj === null) return false;
|
36
|
-
var proto = obj;
|
37
|
-
|
38
|
-
while (Object.getPrototypeOf(proto) !== null) {
|
39
|
-
proto = Object.getPrototypeOf(proto);
|
40
|
-
}
|
41
|
-
|
42
|
-
return Object.getPrototypeOf(obj) === proto;
|
43
|
-
}
|
44
|
-
|
45
|
-
// Inlined / shortened version of `kindOf` from https://github.com/jonschlinkert/kind-of
|
46
|
-
function miniKindOf(val) {
|
47
|
-
if (val === void 0) return 'undefined';
|
48
|
-
if (val === null) return 'null';
|
49
|
-
var type = typeof val;
|
50
|
-
|
51
|
-
switch (type) {
|
52
|
-
case 'boolean':
|
53
|
-
case 'string':
|
54
|
-
case 'number':
|
55
|
-
case 'symbol':
|
56
|
-
case 'function':
|
57
|
-
{
|
58
|
-
return type;
|
59
|
-
}
|
60
|
-
}
|
61
|
-
|
62
|
-
if (Array.isArray(val)) return 'array';
|
63
|
-
if (isDate(val)) return 'date';
|
64
|
-
if (isError(val)) return 'error';
|
65
|
-
var constructorName = ctorName(val);
|
66
|
-
|
67
|
-
switch (constructorName) {
|
68
|
-
case 'Symbol':
|
69
|
-
case 'Promise':
|
70
|
-
case 'WeakMap':
|
71
|
-
case 'WeakSet':
|
72
|
-
case 'Map':
|
73
|
-
case 'Set':
|
74
|
-
return constructorName;
|
75
|
-
} // other
|
76
|
-
|
77
|
-
|
78
|
-
return type.slice(8, -1).toLowerCase().replace(/\s/g, '');
|
79
|
-
}
|
80
|
-
|
81
|
-
function ctorName(val) {
|
82
|
-
return typeof val.constructor === 'function' ? val.constructor.name : null;
|
83
|
-
}
|
84
|
-
|
85
|
-
function isError(val) {
|
86
|
-
return val instanceof Error || typeof val.message === 'string' && val.constructor && typeof val.constructor.stackTraceLimit === 'number';
|
87
|
-
}
|
88
|
-
|
89
|
-
function isDate(val) {
|
90
|
-
if (val instanceof Date) return true;
|
91
|
-
return typeof val.toDateString === 'function' && typeof val.getDate === 'function' && typeof val.setDate === 'function';
|
92
|
-
}
|
93
|
-
|
94
|
-
function kindOf(val) {
|
95
|
-
var typeOfVal = typeof val;
|
96
|
-
|
97
|
-
{
|
98
|
-
typeOfVal = miniKindOf(val);
|
99
|
-
}
|
100
|
-
|
101
|
-
return typeOfVal;
|
102
|
-
}
|
103
|
-
|
104
|
-
/**
|
105
|
-
* @deprecated
|
106
|
-
*
|
107
|
-
* **We recommend using the `configureStore` method
|
108
|
-
* of the `@reduxjs/toolkit` package**, which replaces `createStore`.
|
109
|
-
*
|
110
|
-
* Redux Toolkit is our recommended approach for writing Redux logic today,
|
111
|
-
* including store setup, reducers, data fetching, and more.
|
112
|
-
*
|
113
|
-
* **For more details, please read this Redux docs page:**
|
114
|
-
* **https://redux.js.org/introduction/why-rtk-is-redux-today**
|
115
|
-
*
|
116
|
-
* `configureStore` from Redux Toolkit is an improved version of `createStore` that
|
117
|
-
* simplifies setup and helps avoid common bugs.
|
118
|
-
*
|
119
|
-
* You should not be using the `redux` core package by itself today, except for learning purposes.
|
120
|
-
* The `createStore` method from the core `redux` package will not be removed, but we encourage
|
121
|
-
* all users to migrate to using Redux Toolkit for all Redux code.
|
122
|
-
*
|
123
|
-
* If you want to use `createStore` without this visual deprecation warning, use
|
124
|
-
* the `legacy_createStore` import instead:
|
125
|
-
*
|
126
|
-
* `import { legacy_createStore as createStore} from 'redux'`
|
127
|
-
*
|
128
|
-
*/
|
129
|
-
|
130
|
-
function createStore(reducer, preloadedState, enhancer) {
|
131
|
-
var _ref2;
|
132
|
-
|
133
|
-
if (typeof preloadedState === 'function' && typeof enhancer === 'function' || typeof enhancer === 'function' && typeof arguments[3] === 'function') {
|
134
|
-
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. See https://redux.js.org/tutorials/fundamentals/part-4-store#creating-a-store-with-enhancers for an example.');
|
135
|
-
}
|
136
|
-
|
137
|
-
if (typeof preloadedState === 'function' && typeof enhancer === 'undefined') {
|
138
|
-
enhancer = preloadedState;
|
139
|
-
preloadedState = undefined;
|
140
|
-
}
|
141
|
-
|
142
|
-
if (typeof enhancer !== 'undefined') {
|
143
|
-
if (typeof enhancer !== 'function') {
|
144
|
-
throw new Error("Expected the enhancer to be a function. Instead, received: '" + kindOf(enhancer) + "'");
|
145
|
-
}
|
146
|
-
|
147
|
-
return enhancer(createStore)(reducer, preloadedState);
|
148
|
-
}
|
149
|
-
|
150
|
-
if (typeof reducer !== 'function') {
|
151
|
-
throw new Error("Expected the root reducer to be a function. Instead, received: '" + kindOf(reducer) + "'");
|
152
|
-
}
|
153
|
-
|
154
|
-
var currentReducer = reducer;
|
155
|
-
var currentState = preloadedState;
|
156
|
-
var currentListeners = [];
|
157
|
-
var nextListeners = currentListeners;
|
158
|
-
var isDispatching = false;
|
159
|
-
/**
|
160
|
-
* This makes a shallow copy of currentListeners so we can use
|
161
|
-
* nextListeners as a temporary list while dispatching.
|
162
|
-
*
|
163
|
-
* This prevents any bugs around consumers calling
|
164
|
-
* subscribe/unsubscribe in the middle of a dispatch.
|
165
|
-
*/
|
166
|
-
|
167
|
-
function ensureCanMutateNextListeners() {
|
168
|
-
if (nextListeners === currentListeners) {
|
169
|
-
nextListeners = currentListeners.slice();
|
170
|
-
}
|
171
|
-
}
|
172
|
-
/**
|
173
|
-
* Reads the state tree managed by the store.
|
174
|
-
*
|
175
|
-
* @returns {any} The current state tree of your application.
|
176
|
-
*/
|
177
|
-
|
178
|
-
|
179
|
-
function getState() {
|
180
|
-
if (isDispatching) {
|
181
|
-
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.');
|
182
|
-
}
|
183
|
-
|
184
|
-
return currentState;
|
185
|
-
}
|
186
|
-
/**
|
187
|
-
* Adds a change listener. It will be called any time an action is dispatched,
|
188
|
-
* and some part of the state tree may potentially have changed. You may then
|
189
|
-
* call `getState()` to read the current state tree inside the callback.
|
190
|
-
*
|
191
|
-
* You may call `dispatch()` from a change listener, with the following
|
192
|
-
* caveats:
|
193
|
-
*
|
194
|
-
* 1. The subscriptions are snapshotted just before every `dispatch()` call.
|
195
|
-
* If you subscribe or unsubscribe while the listeners are being invoked, this
|
196
|
-
* will not have any effect on the `dispatch()` that is currently in progress.
|
197
|
-
* However, the next `dispatch()` call, whether nested or not, will use a more
|
198
|
-
* recent snapshot of the subscription list.
|
199
|
-
*
|
200
|
-
* 2. The listener should not expect to see all state changes, as the state
|
201
|
-
* might have been updated multiple times during a nested `dispatch()` before
|
202
|
-
* the listener is called. It is, however, guaranteed that all subscribers
|
203
|
-
* registered before the `dispatch()` started will be called with the latest
|
204
|
-
* state by the time it exits.
|
205
|
-
*
|
206
|
-
* @param {Function} listener A callback to be invoked on every dispatch.
|
207
|
-
* @returns {Function} A function to remove this change listener.
|
208
|
-
*/
|
209
|
-
|
210
|
-
|
211
|
-
function subscribe(listener) {
|
212
|
-
if (typeof listener !== 'function') {
|
213
|
-
throw new Error("Expected the listener to be a function. Instead, received: '" + kindOf(listener) + "'");
|
214
|
-
}
|
215
|
-
|
216
|
-
if (isDispatching) {
|
217
|
-
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/store#subscribelistener for more details.');
|
218
|
-
}
|
219
|
-
|
220
|
-
var isSubscribed = true;
|
221
|
-
ensureCanMutateNextListeners();
|
222
|
-
nextListeners.push(listener);
|
223
|
-
return function unsubscribe() {
|
224
|
-
if (!isSubscribed) {
|
225
|
-
return;
|
226
|
-
}
|
227
|
-
|
228
|
-
if (isDispatching) {
|
229
|
-
throw new Error('You may not unsubscribe from a store listener while the reducer is executing. ' + 'See https://redux.js.org/api/store#subscribelistener for more details.');
|
230
|
-
}
|
231
|
-
|
232
|
-
isSubscribed = false;
|
233
|
-
ensureCanMutateNextListeners();
|
234
|
-
var index = nextListeners.indexOf(listener);
|
235
|
-
nextListeners.splice(index, 1);
|
236
|
-
currentListeners = null;
|
237
|
-
};
|
238
|
-
}
|
239
|
-
/**
|
240
|
-
* Dispatches an action. It is the only way to trigger a state change.
|
241
|
-
*
|
242
|
-
* The `reducer` function, used to create the store, will be called with the
|
243
|
-
* current state tree and the given `action`. Its return value will
|
244
|
-
* be considered the **next** state of the tree, and the change listeners
|
245
|
-
* will be notified.
|
246
|
-
*
|
247
|
-
* The base implementation only supports plain object actions. If you want to
|
248
|
-
* dispatch a Promise, an Observable, a thunk, or something else, you need to
|
249
|
-
* wrap your store creating function into the corresponding middleware. For
|
250
|
-
* example, see the documentation for the `redux-thunk` package. Even the
|
251
|
-
* middleware will eventually dispatch plain object actions using this method.
|
252
|
-
*
|
253
|
-
* @param {Object} action A plain object representing “what changed”. It is
|
254
|
-
* a good idea to keep actions serializable so you can record and replay user
|
255
|
-
* sessions, or use the time travelling `redux-devtools`. An action must have
|
256
|
-
* a `type` property which may not be `undefined`. It is a good idea to use
|
257
|
-
* string constants for action types.
|
258
|
-
*
|
259
|
-
* @returns {Object} For convenience, the same action object you dispatched.
|
260
|
-
*
|
261
|
-
* Note that, if you use a custom middleware, it may wrap `dispatch()` to
|
262
|
-
* return something else (for example, a Promise you can await).
|
263
|
-
*/
|
264
|
-
|
265
|
-
|
266
|
-
function dispatch(action) {
|
267
|
-
if (!isPlainObject(action)) {
|
268
|
-
throw new Error("Actions must be plain objects. Instead, the actual type was: '" + kindOf(action) + "'. You may need to add middleware to your store setup to handle dispatching other values, such as 'redux-thunk' to handle dispatching functions. See https://redux.js.org/tutorials/fundamentals/part-4-store#middleware and https://redux.js.org/tutorials/fundamentals/part-6-async-logic#using-the-redux-thunk-middleware for examples.");
|
269
|
-
}
|
270
|
-
|
271
|
-
if (typeof action.type === 'undefined') {
|
272
|
-
throw new Error('Actions may not have an undefined "type" property. You may have misspelled an action type string constant.');
|
273
|
-
}
|
274
|
-
|
275
|
-
if (isDispatching) {
|
276
|
-
throw new Error('Reducers may not dispatch actions.');
|
277
|
-
}
|
278
|
-
|
279
|
-
try {
|
280
|
-
isDispatching = true;
|
281
|
-
currentState = currentReducer(currentState, action);
|
282
|
-
} finally {
|
283
|
-
isDispatching = false;
|
284
|
-
}
|
285
|
-
|
286
|
-
var listeners = currentListeners = nextListeners;
|
287
|
-
|
288
|
-
for (var i = 0; i < listeners.length; i++) {
|
289
|
-
var listener = listeners[i];
|
290
|
-
listener();
|
291
|
-
}
|
292
|
-
|
293
|
-
return action;
|
294
|
-
}
|
295
|
-
/**
|
296
|
-
* Replaces the reducer currently used by the store to calculate the state.
|
297
|
-
*
|
298
|
-
* You might need this if your app implements code splitting and you want to
|
299
|
-
* load some of the reducers dynamically. You might also need this if you
|
300
|
-
* implement a hot reloading mechanism for Redux.
|
301
|
-
*
|
302
|
-
* @param {Function} nextReducer The reducer for the store to use instead.
|
303
|
-
* @returns {void}
|
304
|
-
*/
|
305
|
-
|
306
|
-
|
307
|
-
function replaceReducer(nextReducer) {
|
308
|
-
if (typeof nextReducer !== 'function') {
|
309
|
-
throw new Error("Expected the nextReducer to be a function. Instead, received: '" + kindOf(nextReducer));
|
310
|
-
}
|
311
|
-
|
312
|
-
currentReducer = nextReducer; // This action has a similiar effect to ActionTypes.INIT.
|
313
|
-
// Any reducers that existed in both the new and old rootReducer
|
314
|
-
// will receive the previous state. This effectively populates
|
315
|
-
// the new state tree with any relevant data from the old one.
|
316
|
-
|
317
|
-
dispatch({
|
318
|
-
type: ActionTypes.REPLACE
|
319
|
-
});
|
320
|
-
}
|
321
|
-
/**
|
322
|
-
* Interoperability point for observable/reactive libraries.
|
323
|
-
* @returns {observable} A minimal observable of state changes.
|
324
|
-
* For more information, see the observable proposal:
|
325
|
-
* https://github.com/tc39/proposal-observable
|
326
|
-
*/
|
327
|
-
|
328
|
-
|
329
|
-
function observable() {
|
330
|
-
var _ref;
|
331
|
-
|
332
|
-
var outerSubscribe = subscribe;
|
333
|
-
return _ref = {
|
334
|
-
/**
|
335
|
-
* The minimal observable subscription method.
|
336
|
-
* @param {Object} observer Any object that can be used as an observer.
|
337
|
-
* The observer object should have a `next` method.
|
338
|
-
* @returns {subscription} An object with an `unsubscribe` method that can
|
339
|
-
* be used to unsubscribe the observable from the store, and prevent further
|
340
|
-
* emission of values from the observable.
|
341
|
-
*/
|
342
|
-
subscribe: function subscribe(observer) {
|
343
|
-
if (typeof observer !== 'object' || observer === null) {
|
344
|
-
throw new Error("Expected the observer to be an object. Instead, received: '" + kindOf(observer) + "'");
|
345
|
-
}
|
346
|
-
|
347
|
-
function observeState() {
|
348
|
-
if (observer.next) {
|
349
|
-
observer.next(getState());
|
350
|
-
}
|
351
|
-
}
|
352
|
-
|
353
|
-
observeState();
|
354
|
-
var unsubscribe = outerSubscribe(observeState);
|
355
|
-
return {
|
356
|
-
unsubscribe: unsubscribe
|
357
|
-
};
|
358
|
-
}
|
359
|
-
}, _ref[$$observable] = function () {
|
360
|
-
return this;
|
361
|
-
}, _ref;
|
362
|
-
} // When a store is created, an "INIT" action is dispatched so that every
|
363
|
-
// reducer returns their initial state. This effectively populates
|
364
|
-
// the initial state tree.
|
365
|
-
|
366
|
-
|
367
|
-
dispatch({
|
368
|
-
type: ActionTypes.INIT
|
369
|
-
});
|
370
|
-
return _ref2 = {
|
371
|
-
dispatch: dispatch,
|
372
|
-
subscribe: subscribe,
|
373
|
-
getState: getState,
|
374
|
-
replaceReducer: replaceReducer
|
375
|
-
}, _ref2[$$observable] = observable, _ref2;
|
376
|
-
}
|
377
|
-
/**
|
378
|
-
* Creates a Redux store that holds the state tree.
|
379
|
-
*
|
380
|
-
* **We recommend using `configureStore` from the
|
381
|
-
* `@reduxjs/toolkit` package**, which replaces `createStore`:
|
382
|
-
* **https://redux.js.org/introduction/why-rtk-is-redux-today**
|
383
|
-
*
|
384
|
-
* The only way to change the data in the store is to call `dispatch()` on it.
|
385
|
-
*
|
386
|
-
* There should only be a single store in your app. To specify how different
|
387
|
-
* parts of the state tree respond to actions, you may combine several reducers
|
388
|
-
* into a single reducer function by using `combineReducers`.
|
389
|
-
*
|
390
|
-
* @param {Function} reducer A function that returns the next state tree, given
|
391
|
-
* the current state tree and the action to handle.
|
392
|
-
*
|
393
|
-
* @param {any} [preloadedState] The initial state. You may optionally specify it
|
394
|
-
* to hydrate the state from the server in universal apps, or to restore a
|
395
|
-
* previously serialized user session.
|
396
|
-
* If you use `combineReducers` to produce the root reducer function, this must be
|
397
|
-
* an object with the same shape as `combineReducers` keys.
|
398
|
-
*
|
399
|
-
* @param {Function} [enhancer] The store enhancer. You may optionally specify it
|
400
|
-
* to enhance the store with third-party capabilities such as middleware,
|
401
|
-
* time travel, persistence, etc. The only store enhancer that ships with Redux
|
402
|
-
* is `applyMiddleware()`.
|
403
|
-
*
|
404
|
-
* @returns {Store} A Redux store that lets you read the state, dispatch actions
|
405
|
-
* and subscribe to changes.
|
406
|
-
*/
|
407
|
-
|
408
|
-
var legacy_createStore = createStore;
|
409
|
-
|
410
|
-
/**
|
411
|
-
* Prints a warning in the console if it exists.
|
412
|
-
*
|
413
|
-
* @param {String} message The warning message.
|
414
|
-
* @returns {void}
|
415
|
-
*/
|
416
|
-
function warning(message) {
|
417
|
-
/* eslint-disable no-console */
|
418
|
-
if (typeof console !== 'undefined' && typeof console.error === 'function') {
|
419
|
-
console.error(message);
|
420
|
-
}
|
421
|
-
/* eslint-enable no-console */
|
422
|
-
|
423
|
-
|
424
|
-
try {
|
425
|
-
// This error was thrown as a convenience so that if you enable
|
426
|
-
// "break on all exceptions" in your console,
|
427
|
-
// it would pause the execution at this line.
|
428
|
-
throw new Error(message);
|
429
|
-
} catch (e) {} // eslint-disable-line no-empty
|
430
|
-
|
431
|
-
}
|
432
|
-
|
433
|
-
function getUnexpectedStateShapeWarningMessage(inputState, reducers, action, unexpectedKeyCache) {
|
434
|
-
var reducerKeys = Object.keys(reducers);
|
435
|
-
var argumentName = action && action.type === ActionTypes.INIT ? 'preloadedState argument passed to createStore' : 'previous state received by the reducer';
|
436
|
-
|
437
|
-
if (reducerKeys.length === 0) {
|
438
|
-
return 'Store does not have a valid reducer. Make sure the argument passed ' + 'to combineReducers is an object whose values are reducers.';
|
439
|
-
}
|
440
|
-
|
441
|
-
if (!isPlainObject(inputState)) {
|
442
|
-
return "The " + argumentName + " has unexpected type of \"" + kindOf(inputState) + "\". Expected argument to be an object with the following " + ("keys: \"" + reducerKeys.join('", "') + "\"");
|
443
|
-
}
|
444
|
-
|
445
|
-
var unexpectedKeys = Object.keys(inputState).filter(function (key) {
|
446
|
-
return !reducers.hasOwnProperty(key) && !unexpectedKeyCache[key];
|
447
|
-
});
|
448
|
-
unexpectedKeys.forEach(function (key) {
|
449
|
-
unexpectedKeyCache[key] = true;
|
450
|
-
});
|
451
|
-
if (action && action.type === ActionTypes.REPLACE) return;
|
452
|
-
|
453
|
-
if (unexpectedKeys.length > 0) {
|
454
|
-
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.");
|
455
|
-
}
|
456
|
-
}
|
457
|
-
|
458
|
-
function assertReducerShape(reducers) {
|
459
|
-
Object.keys(reducers).forEach(function (key) {
|
460
|
-
var reducer = reducers[key];
|
461
|
-
var initialState = reducer(undefined, {
|
462
|
-
type: ActionTypes.INIT
|
463
|
-
});
|
464
|
-
|
465
|
-
if (typeof initialState === 'undefined') {
|
466
|
-
throw new Error("The slice reducer for key \"" + 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.");
|
467
|
-
}
|
468
|
-
|
469
|
-
if (typeof reducer(undefined, {
|
470
|
-
type: ActionTypes.PROBE_UNKNOWN_ACTION()
|
471
|
-
}) === 'undefined') {
|
472
|
-
throw new Error("The slice reducer for key \"" + 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.");
|
473
|
-
}
|
474
|
-
});
|
475
|
-
}
|
476
|
-
/**
|
477
|
-
* Turns an object whose values are different reducer functions, into a single
|
478
|
-
* reducer function. It will call every child reducer, and gather their results
|
479
|
-
* into a single state object, whose keys correspond to the keys of the passed
|
480
|
-
* reducer functions.
|
481
|
-
*
|
482
|
-
* @param {Object} reducers An object whose values correspond to different
|
483
|
-
* reducer functions that need to be combined into one. One handy way to obtain
|
484
|
-
* it is to use ES6 `import * as reducers` syntax. The reducers may never return
|
485
|
-
* undefined for any action. Instead, they should return their initial state
|
486
|
-
* if the state passed to them was undefined, and the current state for any
|
487
|
-
* unrecognized action.
|
488
|
-
*
|
489
|
-
* @returns {Function} A reducer function that invokes every reducer inside the
|
490
|
-
* passed object, and builds a state object with the same shape.
|
491
|
-
*/
|
492
|
-
|
493
|
-
|
494
|
-
function combineReducers(reducers) {
|
495
|
-
var reducerKeys = Object.keys(reducers);
|
496
|
-
var finalReducers = {};
|
497
|
-
|
498
|
-
for (var i = 0; i < reducerKeys.length; i++) {
|
499
|
-
var key = reducerKeys[i];
|
500
|
-
|
501
|
-
{
|
502
|
-
if (typeof reducers[key] === 'undefined') {
|
503
|
-
warning("No reducer provided for key \"" + key + "\"");
|
504
|
-
}
|
505
|
-
}
|
506
|
-
|
507
|
-
if (typeof reducers[key] === 'function') {
|
508
|
-
finalReducers[key] = reducers[key];
|
509
|
-
}
|
510
|
-
}
|
511
|
-
|
512
|
-
var finalReducerKeys = Object.keys(finalReducers); // This is used to make sure we don't warn about the same
|
513
|
-
// keys multiple times.
|
514
|
-
|
515
|
-
var unexpectedKeyCache;
|
516
|
-
|
517
|
-
{
|
518
|
-
unexpectedKeyCache = {};
|
519
|
-
}
|
520
|
-
|
521
|
-
var shapeAssertionError;
|
522
|
-
|
523
|
-
try {
|
524
|
-
assertReducerShape(finalReducers);
|
525
|
-
} catch (e) {
|
526
|
-
shapeAssertionError = e;
|
527
|
-
}
|
528
|
-
|
529
|
-
return function combination(state, action) {
|
530
|
-
if (state === void 0) {
|
531
|
-
state = {};
|
532
|
-
}
|
533
|
-
|
534
|
-
if (shapeAssertionError) {
|
535
|
-
throw shapeAssertionError;
|
536
|
-
}
|
537
|
-
|
538
|
-
{
|
539
|
-
var warningMessage = getUnexpectedStateShapeWarningMessage(state, finalReducers, action, unexpectedKeyCache);
|
540
|
-
|
541
|
-
if (warningMessage) {
|
542
|
-
warning(warningMessage);
|
543
|
-
}
|
544
|
-
}
|
545
|
-
|
546
|
-
var hasChanged = false;
|
547
|
-
var nextState = {};
|
548
|
-
|
549
|
-
for (var _i = 0; _i < finalReducerKeys.length; _i++) {
|
550
|
-
var _key = finalReducerKeys[_i];
|
551
|
-
var reducer = finalReducers[_key];
|
552
|
-
var previousStateForKey = state[_key];
|
553
|
-
var nextStateForKey = reducer(previousStateForKey, action);
|
554
|
-
|
555
|
-
if (typeof nextStateForKey === 'undefined') {
|
556
|
-
var actionType = action && action.type;
|
557
|
-
throw new Error("When called with an action of type " + (actionType ? "\"" + String(actionType) + "\"" : '(unknown type)') + ", the slice reducer for key \"" + _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.");
|
558
|
-
}
|
559
|
-
|
560
|
-
nextState[_key] = nextStateForKey;
|
561
|
-
hasChanged = hasChanged || nextStateForKey !== previousStateForKey;
|
562
|
-
}
|
563
|
-
|
564
|
-
hasChanged = hasChanged || finalReducerKeys.length !== Object.keys(state).length;
|
565
|
-
return hasChanged ? nextState : state;
|
566
|
-
};
|
567
|
-
}
|
568
|
-
|
569
|
-
function bindActionCreator(actionCreator, dispatch) {
|
570
|
-
return function () {
|
571
|
-
return dispatch(actionCreator.apply(this, arguments));
|
572
|
-
};
|
573
|
-
}
|
574
|
-
/**
|
575
|
-
* Turns an object whose values are action creators, into an object with the
|
576
|
-
* same keys, but with every function wrapped into a `dispatch` call so they
|
577
|
-
* may be invoked directly. This is just a convenience method, as you can call
|
578
|
-
* `store.dispatch(MyActionCreators.doSomething())` yourself just fine.
|
579
|
-
*
|
580
|
-
* For convenience, you can also pass an action creator as the first argument,
|
581
|
-
* and get a dispatch wrapped function in return.
|
582
|
-
*
|
583
|
-
* @param {Function|Object} actionCreators An object whose values are action
|
584
|
-
* creator functions. One handy way to obtain it is to use ES6 `import * as`
|
585
|
-
* syntax. You may also pass a single function.
|
586
|
-
*
|
587
|
-
* @param {Function} dispatch The `dispatch` function available on your Redux
|
588
|
-
* store.
|
589
|
-
*
|
590
|
-
* @returns {Function|Object} The object mimicking the original object, but with
|
591
|
-
* every action creator wrapped into the `dispatch` call. If you passed a
|
592
|
-
* function as `actionCreators`, the return value will also be a single
|
593
|
-
* function.
|
594
|
-
*/
|
595
|
-
|
596
|
-
|
597
|
-
function bindActionCreators(actionCreators, dispatch) {
|
598
|
-
if (typeof actionCreators === 'function') {
|
599
|
-
return bindActionCreator(actionCreators, dispatch);
|
600
|
-
}
|
601
|
-
|
602
|
-
if (typeof actionCreators !== 'object' || actionCreators === null) {
|
603
|
-
throw new Error("bindActionCreators expected an object or a function, but instead received: '" + kindOf(actionCreators) + "'. " + "Did you write \"import ActionCreators from\" instead of \"import * as ActionCreators from\"?");
|
604
|
-
}
|
605
|
-
|
606
|
-
var boundActionCreators = {};
|
607
|
-
|
608
|
-
for (var key in actionCreators) {
|
609
|
-
var actionCreator = actionCreators[key];
|
610
|
-
|
611
|
-
if (typeof actionCreator === 'function') {
|
612
|
-
boundActionCreators[key] = bindActionCreator(actionCreator, dispatch);
|
613
|
-
}
|
614
|
-
}
|
615
|
-
|
616
|
-
return boundActionCreators;
|
617
|
-
}
|
618
|
-
|
619
|
-
function _defineProperty(obj, key, value) {
|
620
|
-
if (key in obj) {
|
621
|
-
Object.defineProperty(obj, key, {
|
622
|
-
value: value,
|
623
|
-
enumerable: true,
|
624
|
-
configurable: true,
|
625
|
-
writable: true
|
626
|
-
});
|
627
|
-
} else {
|
628
|
-
obj[key] = value;
|
629
|
-
}
|
630
|
-
|
631
|
-
return obj;
|
632
|
-
}
|
633
|
-
|
634
|
-
function ownKeys(object, enumerableOnly) {
|
635
|
-
var keys = Object.keys(object);
|
636
|
-
|
637
|
-
if (Object.getOwnPropertySymbols) {
|
638
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
639
|
-
if (enumerableOnly) symbols = symbols.filter(function (sym) {
|
640
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
641
|
-
});
|
642
|
-
keys.push.apply(keys, symbols);
|
643
|
-
}
|
644
|
-
|
645
|
-
return keys;
|
646
|
-
}
|
647
|
-
|
648
|
-
function _objectSpread2(target) {
|
649
|
-
for (var i = 1; i < arguments.length; i++) {
|
650
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
651
|
-
|
652
|
-
if (i % 2) {
|
653
|
-
ownKeys(Object(source), true).forEach(function (key) {
|
654
|
-
_defineProperty(target, key, source[key]);
|
655
|
-
});
|
656
|
-
} else if (Object.getOwnPropertyDescriptors) {
|
657
|
-
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
658
|
-
} else {
|
659
|
-
ownKeys(Object(source)).forEach(function (key) {
|
660
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
661
|
-
});
|
662
|
-
}
|
663
|
-
}
|
664
|
-
|
665
|
-
return target;
|
666
|
-
}
|
667
|
-
|
668
|
-
/**
|
669
|
-
* Composes single-argument functions from right to left. The rightmost
|
670
|
-
* function can take multiple arguments as it provides the signature for
|
671
|
-
* the resulting composite function.
|
672
|
-
*
|
673
|
-
* @param {...Function} funcs The functions to compose.
|
674
|
-
* @returns {Function} A function obtained by composing the argument functions
|
675
|
-
* from right to left. For example, compose(f, g, h) is identical to doing
|
676
|
-
* (...args) => f(g(h(...args))).
|
677
|
-
*/
|
678
|
-
function compose() {
|
679
|
-
for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) {
|
680
|
-
funcs[_key] = arguments[_key];
|
681
|
-
}
|
682
|
-
|
683
|
-
if (funcs.length === 0) {
|
684
|
-
return function (arg) {
|
685
|
-
return arg;
|
686
|
-
};
|
687
|
-
}
|
688
|
-
|
689
|
-
if (funcs.length === 1) {
|
690
|
-
return funcs[0];
|
691
|
-
}
|
692
|
-
|
693
|
-
return funcs.reduce(function (a, b) {
|
694
|
-
return function () {
|
695
|
-
return a(b.apply(void 0, arguments));
|
696
|
-
};
|
697
|
-
});
|
698
|
-
}
|
699
|
-
|
700
|
-
/**
|
701
|
-
* Creates a store enhancer that applies middleware to the dispatch method
|
702
|
-
* of the Redux store. This is handy for a variety of tasks, such as expressing
|
703
|
-
* asynchronous actions in a concise manner, or logging every action payload.
|
704
|
-
*
|
705
|
-
* See `redux-thunk` package as an example of the Redux middleware.
|
706
|
-
*
|
707
|
-
* Because middleware is potentially asynchronous, this should be the first
|
708
|
-
* store enhancer in the composition chain.
|
709
|
-
*
|
710
|
-
* Note that each middleware will be given the `dispatch` and `getState` functions
|
711
|
-
* as named arguments.
|
712
|
-
*
|
713
|
-
* @param {...Function} middlewares The middleware chain to be applied.
|
714
|
-
* @returns {Function} A store enhancer applying the middleware.
|
715
|
-
*/
|
716
|
-
|
717
|
-
function applyMiddleware() {
|
718
|
-
for (var _len = arguments.length, middlewares = new Array(_len), _key = 0; _key < _len; _key++) {
|
719
|
-
middlewares[_key] = arguments[_key];
|
720
|
-
}
|
721
|
-
|
722
|
-
return function (createStore) {
|
723
|
-
return function () {
|
724
|
-
var store = createStore.apply(void 0, arguments);
|
725
|
-
|
726
|
-
var _dispatch = function dispatch() {
|
727
|
-
throw new Error('Dispatching while constructing your middleware is not allowed. ' + 'Other middleware would not be applied to this dispatch.');
|
728
|
-
};
|
729
|
-
|
730
|
-
var middlewareAPI = {
|
731
|
-
getState: store.getState,
|
732
|
-
dispatch: function dispatch() {
|
733
|
-
return _dispatch.apply(void 0, arguments);
|
734
|
-
}
|
735
|
-
};
|
736
|
-
var chain = middlewares.map(function (middleware) {
|
737
|
-
return middleware(middlewareAPI);
|
738
|
-
});
|
739
|
-
_dispatch = compose.apply(void 0, chain)(store.dispatch);
|
740
|
-
return _objectSpread2(_objectSpread2({}, store), {}, {
|
741
|
-
dispatch: _dispatch
|
742
|
-
});
|
743
|
-
};
|
744
|
-
};
|
745
|
-
}
|
746
|
-
|
747
|
-
/*
|
748
|
-
* This is a dummy function to check if the function name has been altered by minification.
|
749
|
-
* If the function has been minified and NODE_ENV !== 'production', warn the user.
|
750
|
-
*/
|
751
|
-
|
752
|
-
function isCrushed() {}
|
753
|
-
|
754
|
-
if (typeof isCrushed.name === 'string' && isCrushed.name !== 'isCrushed') {
|
755
|
-
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.');
|
756
|
-
}
|
757
|
-
|
758
|
-
exports.__DO_NOT_USE__ActionTypes = ActionTypes;
|
759
|
-
exports.applyMiddleware = applyMiddleware;
|
760
|
-
exports.bindActionCreators = bindActionCreators;
|
761
|
-
exports.combineReducers = combineReducers;
|
762
|
-
exports.compose = compose;
|
763
|
-
exports.createStore = createStore;
|
764
|
-
exports.legacy_createStore = legacy_createStore;
|
765
|
-
|
766
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
767
|
-
|
768
|
-
})));
|