WIP - add extractor, generate snippet_data
This commit is contained in:
97
node_modules/react-redux/es/utils/Subscription.js
generated
vendored
Normal file
97
node_modules/react-redux/es/utils/Subscription.js
generated
vendored
Normal file
@ -0,0 +1,97 @@
|
||||
import { getBatch } from './batch'; // 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() {
|
||||
var batch = getBatch(); // 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;
|
||||
batch(function () {
|
||||
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 =
|
||||
/*#__PURE__*/
|
||||
function () {
|
||||
function Subscription(store, parentSub) {
|
||||
this.store = store;
|
||||
this.parentSub = parentSub;
|
||||
this.unsubscribe = null;
|
||||
this.listeners = nullListeners;
|
||||
this.handleChangeWrapper = this.handleChangeWrapper.bind(this);
|
||||
}
|
||||
|
||||
var _proto = Subscription.prototype;
|
||||
|
||||
_proto.addNestedSub = function addNestedSub(listener) {
|
||||
this.trySubscribe();
|
||||
return this.listeners.subscribe(listener);
|
||||
};
|
||||
|
||||
_proto.notifyNestedSubs = function notifyNestedSubs() {
|
||||
this.listeners.notify();
|
||||
};
|
||||
|
||||
_proto.handleChangeWrapper = function handleChangeWrapper() {
|
||||
if (this.onStateChange) {
|
||||
this.onStateChange();
|
||||
}
|
||||
};
|
||||
|
||||
_proto.isSubscribed = function isSubscribed() {
|
||||
return Boolean(this.unsubscribe);
|
||||
};
|
||||
|
||||
_proto.trySubscribe = function trySubscribe() {
|
||||
if (!this.unsubscribe) {
|
||||
this.unsubscribe = this.parentSub ? this.parentSub.addNestedSub(this.handleChangeWrapper) : this.store.subscribe(this.handleChangeWrapper);
|
||||
this.listeners = createListenerCollection();
|
||||
}
|
||||
};
|
||||
|
||||
_proto.tryUnsubscribe = function tryUnsubscribe() {
|
||||
if (this.unsubscribe) {
|
||||
this.unsubscribe();
|
||||
this.unsubscribe = null;
|
||||
this.listeners.clear();
|
||||
this.listeners = nullListeners;
|
||||
}
|
||||
};
|
||||
|
||||
return Subscription;
|
||||
}();
|
||||
|
||||
export { Subscription as default };
|
||||
14
node_modules/react-redux/es/utils/batch.js
generated
vendored
Normal file
14
node_modules/react-redux/es/utils/batch.js
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
// Default to a dummy "batch" implementation that just runs the callback
|
||||
function defaultNoopBatch(callback) {
|
||||
callback();
|
||||
}
|
||||
|
||||
var batch = defaultNoopBatch; // Allow injecting another batching function later
|
||||
|
||||
export var setBatch = function setBatch(newBatch) {
|
||||
return batch = newBatch;
|
||||
}; // Supply a getter just to skip dealing with ESM bindings
|
||||
|
||||
export var getBatch = function getBatch() {
|
||||
return batch;
|
||||
};
|
||||
16
node_modules/react-redux/es/utils/isPlainObject.js
generated
vendored
Normal file
16
node_modules/react-redux/es/utils/isPlainObject.js
generated
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
/**
|
||||
* @param {any} obj The object to inspect.
|
||||
* @returns {boolean} True if the argument appears to be a plain object.
|
||||
*/
|
||||
export default function isPlainObject(obj) {
|
||||
if (typeof obj !== 'object' || obj === null) return false;
|
||||
var proto = Object.getPrototypeOf(obj);
|
||||
if (proto === null) return true;
|
||||
var baseProto = proto;
|
||||
|
||||
while (Object.getPrototypeOf(baseProto) !== null) {
|
||||
baseProto = Object.getPrototypeOf(baseProto);
|
||||
}
|
||||
|
||||
return proto === baseProto;
|
||||
}
|
||||
2
node_modules/react-redux/es/utils/reactBatchedUpdates.js
generated
vendored
Normal file
2
node_modules/react-redux/es/utils/reactBatchedUpdates.js
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
/* eslint-disable import/no-unresolved */
|
||||
export { unstable_batchedUpdates } from 'react-dom';
|
||||
3
node_modules/react-redux/es/utils/reactBatchedUpdates.native.js
generated
vendored
Normal file
3
node_modules/react-redux/es/utils/reactBatchedUpdates.native.js
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
/* eslint-disable import/no-unresolved */
|
||||
import { unstable_batchedUpdates } from 'react-native';
|
||||
export { unstable_batchedUpdates };
|
||||
29
node_modules/react-redux/es/utils/shallowEqual.js
generated
vendored
Normal file
29
node_modules/react-redux/es/utils/shallowEqual.js
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
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;
|
||||
}
|
||||
7
node_modules/react-redux/es/utils/verifyPlainObject.js
generated
vendored
Normal file
7
node_modules/react-redux/es/utils/verifyPlainObject.js
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
import isPlainObject from './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 + ".");
|
||||
}
|
||||
}
|
||||
24
node_modules/react-redux/es/utils/warning.js
generated
vendored
Normal file
24
node_modules/react-redux/es/utils/warning.js
generated
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
/**
|
||||
* 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 */
|
||||
|
||||
}
|
||||
6
node_modules/react-redux/es/utils/wrapActionCreators.js
generated
vendored
Normal file
6
node_modules/react-redux/es/utils/wrapActionCreators.js
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
import { bindActionCreators } from 'redux';
|
||||
export default function wrapActionCreators(actionCreators) {
|
||||
return function (dispatch) {
|
||||
return bindActionCreators(actionCreators, dispatch);
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user