Initial commit
This commit is contained in:
14
node_modules/react-redux/es/utils/PropTypes.js
generated
vendored
Normal file
14
node_modules/react-redux/es/utils/PropTypes.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
export var subscriptionShape = PropTypes.shape({
|
||||
trySubscribe: PropTypes.func.isRequired,
|
||||
tryUnsubscribe: PropTypes.func.isRequired,
|
||||
notifyNestedSubs: PropTypes.func.isRequired,
|
||||
isSubscribed: PropTypes.func.isRequired
|
||||
});
|
||||
|
||||
export var storeShape = PropTypes.shape({
|
||||
subscribe: PropTypes.func.isRequired,
|
||||
dispatch: PropTypes.func.isRequired,
|
||||
getState: PropTypes.func.isRequired
|
||||
});
|
||||
92
node_modules/react-redux/es/utils/Subscription.js
generated
vendored
Normal file
92
node_modules/react-redux/es/utils/Subscription.js
generated
vendored
Normal file
@@ -0,0 +1,92 @@
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
// encapsulates the subscription logic for connecting a component to the redux store, as
|
||||
// well as nesting subscriptions of descendant components, so that we can ensure the
|
||||
// ancestor components re-render before descendants
|
||||
|
||||
var CLEARED = null;
|
||||
var nullListeners = {
|
||||
notify: function notify() {}
|
||||
};
|
||||
|
||||
function createListenerCollection() {
|
||||
// the current/next pattern is copied from redux's createStore code.
|
||||
// TODO: refactor+expose that code to be reusable here?
|
||||
var current = [];
|
||||
var next = [];
|
||||
|
||||
return {
|
||||
clear: function clear() {
|
||||
next = CLEARED;
|
||||
current = CLEARED;
|
||||
},
|
||||
notify: function notify() {
|
||||
var listeners = current = next;
|
||||
for (var i = 0; i < listeners.length; i++) {
|
||||
listeners[i]();
|
||||
}
|
||||
},
|
||||
get: function get() {
|
||||
return next;
|
||||
},
|
||||
subscribe: function subscribe(listener) {
|
||||
var isSubscribed = true;
|
||||
if (next === current) next = current.slice();
|
||||
next.push(listener);
|
||||
|
||||
return function unsubscribe() {
|
||||
if (!isSubscribed || current === CLEARED) return;
|
||||
isSubscribed = false;
|
||||
|
||||
if (next === current) next = current.slice();
|
||||
next.splice(next.indexOf(listener), 1);
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
var Subscription = function () {
|
||||
function Subscription(store, parentSub, onStateChange) {
|
||||
_classCallCheck(this, Subscription);
|
||||
|
||||
this.store = store;
|
||||
this.parentSub = parentSub;
|
||||
this.onStateChange = onStateChange;
|
||||
this.unsubscribe = null;
|
||||
this.listeners = nullListeners;
|
||||
}
|
||||
|
||||
Subscription.prototype.addNestedSub = function addNestedSub(listener) {
|
||||
this.trySubscribe();
|
||||
return this.listeners.subscribe(listener);
|
||||
};
|
||||
|
||||
Subscription.prototype.notifyNestedSubs = function notifyNestedSubs() {
|
||||
this.listeners.notify();
|
||||
};
|
||||
|
||||
Subscription.prototype.isSubscribed = function isSubscribed() {
|
||||
return Boolean(this.unsubscribe);
|
||||
};
|
||||
|
||||
Subscription.prototype.trySubscribe = function trySubscribe() {
|
||||
if (!this.unsubscribe) {
|
||||
this.unsubscribe = this.parentSub ? this.parentSub.addNestedSub(this.onStateChange) : this.store.subscribe(this.onStateChange);
|
||||
|
||||
this.listeners = createListenerCollection();
|
||||
}
|
||||
};
|
||||
|
||||
Subscription.prototype.tryUnsubscribe = function tryUnsubscribe() {
|
||||
if (this.unsubscribe) {
|
||||
this.unsubscribe();
|
||||
this.unsubscribe = null;
|
||||
this.listeners.clear();
|
||||
this.listeners = nullListeners;
|
||||
}
|
||||
};
|
||||
|
||||
return Subscription;
|
||||
}();
|
||||
|
||||
export { Subscription as default };
|
||||
30
node_modules/react-redux/es/utils/shallowEqual.js
generated
vendored
Normal file
30
node_modules/react-redux/es/utils/shallowEqual.js
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
var hasOwn = Object.prototype.hasOwnProperty;
|
||||
|
||||
function is(x, y) {
|
||||
if (x === y) {
|
||||
return x !== 0 || y !== 0 || 1 / x === 1 / y;
|
||||
} else {
|
||||
return x !== x && y !== y;
|
||||
}
|
||||
}
|
||||
|
||||
export default function shallowEqual(objA, objB) {
|
||||
if (is(objA, objB)) return true;
|
||||
|
||||
if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var keysA = Object.keys(objA);
|
||||
var keysB = Object.keys(objB);
|
||||
|
||||
if (keysA.length !== keysB.length) return false;
|
||||
|
||||
for (var i = 0; i < keysA.length; i++) {
|
||||
if (!hasOwn.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
8
node_modules/react-redux/es/utils/verifyPlainObject.js
generated
vendored
Normal file
8
node_modules/react-redux/es/utils/verifyPlainObject.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
import isPlainObject from 'lodash-es/isPlainObject';
|
||||
import warning from './warning';
|
||||
|
||||
export default function verifyPlainObject(value, displayName, methodName) {
|
||||
if (!isPlainObject(value)) {
|
||||
warning(methodName + '() in ' + displayName + ' must return a plain object. Instead received ' + value + '.');
|
||||
}
|
||||
}
|
||||
21
node_modules/react-redux/es/utils/warning.js
generated
vendored
Normal file
21
node_modules/react-redux/es/utils/warning.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* Prints a warning in the console if it exists.
|
||||
*
|
||||
* @param {String} message The warning message.
|
||||
* @returns {void}
|
||||
*/
|
||||
export default function warning(message) {
|
||||
/* eslint-disable no-console */
|
||||
if (typeof console !== 'undefined' && typeof console.error === 'function') {
|
||||
console.error(message);
|
||||
}
|
||||
/* eslint-enable no-console */
|
||||
try {
|
||||
// This error was thrown as a convenience so that if you enable
|
||||
// "break on all exceptions" in your console,
|
||||
// it would pause the execution at this line.
|
||||
throw new Error(message);
|
||||
/* eslint-disable no-empty */
|
||||
} catch (e) {}
|
||||
/* eslint-enable no-empty */
|
||||
}
|
||||
7
node_modules/react-redux/es/utils/wrapActionCreators.js
generated
vendored
Normal file
7
node_modules/react-redux/es/utils/wrapActionCreators.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import { bindActionCreators } from 'redux';
|
||||
|
||||
export default function wrapActionCreators(actionCreators) {
|
||||
return function (dispatch) {
|
||||
return bindActionCreators(actionCreators, dispatch);
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user