mirror of
https://kevinblog.sytes.net/Code/Jibo-Revival-Group/RoboCommander.git
synced 2026-06-15 22:56:02 +00:00
Initial commit
This commit is contained in:
14
node_modules/react-redux/src/utils/PropTypes.js
generated
vendored
Normal file
14
node_modules/react-redux/src/utils/PropTypes.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import PropTypes from 'prop-types'
|
||||
|
||||
export const subscriptionShape = PropTypes.shape({
|
||||
trySubscribe: PropTypes.func.isRequired,
|
||||
tryUnsubscribe: PropTypes.func.isRequired,
|
||||
notifyNestedSubs: PropTypes.func.isRequired,
|
||||
isSubscribed: PropTypes.func.isRequired,
|
||||
})
|
||||
|
||||
export const storeShape = PropTypes.shape({
|
||||
subscribe: PropTypes.func.isRequired,
|
||||
dispatch: PropTypes.func.isRequired,
|
||||
getState: PropTypes.func.isRequired
|
||||
})
|
||||
87
node_modules/react-redux/src/utils/Subscription.js
generated
vendored
Normal file
87
node_modules/react-redux/src/utils/Subscription.js
generated
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
// 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
|
||||
|
||||
const CLEARED = null
|
||||
const nullListeners = { notify() {} }
|
||||
|
||||
function createListenerCollection() {
|
||||
// the current/next pattern is copied from redux's createStore code.
|
||||
// TODO: refactor+expose that code to be reusable here?
|
||||
let current = []
|
||||
let next = []
|
||||
|
||||
return {
|
||||
clear() {
|
||||
next = CLEARED
|
||||
current = CLEARED
|
||||
},
|
||||
|
||||
notify() {
|
||||
const listeners = current = next
|
||||
for (let i = 0; i < listeners.length; i++) {
|
||||
listeners[i]()
|
||||
}
|
||||
},
|
||||
|
||||
get() {
|
||||
return next
|
||||
},
|
||||
|
||||
subscribe(listener) {
|
||||
let 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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default class Subscription {
|
||||
constructor(store, parentSub, onStateChange) {
|
||||
this.store = store
|
||||
this.parentSub = parentSub
|
||||
this.onStateChange = onStateChange
|
||||
this.unsubscribe = null
|
||||
this.listeners = nullListeners
|
||||
}
|
||||
|
||||
addNestedSub(listener) {
|
||||
this.trySubscribe()
|
||||
return this.listeners.subscribe(listener)
|
||||
}
|
||||
|
||||
notifyNestedSubs() {
|
||||
this.listeners.notify()
|
||||
}
|
||||
|
||||
isSubscribed() {
|
||||
return Boolean(this.unsubscribe)
|
||||
}
|
||||
|
||||
trySubscribe() {
|
||||
if (!this.unsubscribe) {
|
||||
this.unsubscribe = this.parentSub
|
||||
? this.parentSub.addNestedSub(this.onStateChange)
|
||||
: this.store.subscribe(this.onStateChange)
|
||||
|
||||
this.listeners = createListenerCollection()
|
||||
}
|
||||
}
|
||||
|
||||
tryUnsubscribe() {
|
||||
if (this.unsubscribe) {
|
||||
this.unsubscribe()
|
||||
this.unsubscribe = null
|
||||
this.listeners.clear()
|
||||
this.listeners = nullListeners
|
||||
}
|
||||
}
|
||||
}
|
||||
32
node_modules/react-redux/src/utils/shallowEqual.js
generated
vendored
Normal file
32
node_modules/react-redux/src/utils/shallowEqual.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
const 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
|
||||
}
|
||||
|
||||
const keysA = Object.keys(objA)
|
||||
const keysB = Object.keys(objB)
|
||||
|
||||
if (keysA.length !== keysB.length) return false
|
||||
|
||||
for (let i = 0; i < keysA.length; i++) {
|
||||
if (!hasOwn.call(objB, keysA[i]) ||
|
||||
!is(objA[keysA[i]], objB[keysA[i]])) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
10
node_modules/react-redux/src/utils/verifyPlainObject.js
generated
vendored
Normal file
10
node_modules/react-redux/src/utils/verifyPlainObject.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
import isPlainObject from 'lodash/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/src/utils/warning.js
generated
vendored
Normal file
21
node_modules/react-redux/src/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 */
|
||||
}
|
||||
5
node_modules/react-redux/src/utils/wrapActionCreators.js
generated
vendored
Normal file
5
node_modules/react-redux/src/utils/wrapActionCreators.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import { bindActionCreators } from 'redux'
|
||||
|
||||
export default function wrapActionCreators(actionCreators) {
|
||||
return dispatch => bindActionCreators(actionCreators, dispatch)
|
||||
}
|
||||
Reference in New Issue
Block a user