code
stringlengths
24
2.07M
docstring
stringlengths
25
85.3k
func_name
stringlengths
1
92
language
stringclasses
1 value
repo
stringlengths
5
64
path
stringlengths
4
172
url
stringlengths
44
218
license
stringclasses
7 values
function unescape(key) { var unescapeRegex = /(=0|=2)/g; var unescaperLookup = { '=0': '=', '=2': ':' }; var keySubstring = key[0] === '.' && key[1] === '$' ? key.substring(2) : key.substring(1); return ('' + keySubstring).replace(unescapeRegex, function (match) { return unescaperLookup[m...
Unescape and unwrap key for human-readable display @param {string} key to unescape. @return {string} the unescaped key.
unescape
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function ReactComponent(props, context, updater) { this.props = props; this.context = context; this.refs = emptyObject; // We initialize the default updater but the real one gets injected by the // renderer. this.updater = updater || ReactNoopUpdateQueue; }
Base class helpers for the updating state of a component.
ReactComponent
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
defineDeprecationWarning = function (methodName, info) { if (canDefineProperty) { Object.defineProperty(ReactComponent.prototype, methodName, { get: function () { process.env.NODE_ENV !== 'production' ? warning(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0]...
Deprecated APIs. These APIs used to exist on classic React classes but since we would like to deprecate them, we're not going to move them over to this modern base class. Instead, we define a getter that warns if it's accessed.
defineDeprecationWarning
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function ReactPureComponent(props, context, updater) { // Duplicated from ReactComponent. this.props = props; this.context = context; this.refs = emptyObject; // We initialize the default updater but the real one gets injected by the // renderer. this.updater = updater || ReactNoopUpdateQueue; }
Base class helpers for the updating state of a component.
ReactPureComponent
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function validateTypeDef(Constructor, typeDef, location) { for (var propName in typeDef) { if (typeDef.hasOwnProperty(propName)) { // use a warning instead of an invariant so components // don't show up in prod but only in __DEV__ process.env.NODE_ENV !== 'production' ? warning(typeof typeD...
Special case getDefaultProps which should move into statics but requires automatic merging.
validateTypeDef
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function validateMethodOverride(isAlreadyDefined, name) { var specPolicy = ReactClassInterface.hasOwnProperty(name) ? ReactClassInterface[name] : null; // Disallow overriding of base class methods unless explicitly allowed. if (ReactClassMixin.hasOwnProperty(name)) { !(specPolicy === 'OVERRIDE_BASE') ? p...
Special case getDefaultProps which should move into statics but requires automatic merging.
validateMethodOverride
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function mixSpecIntoComponent(Constructor, spec) { if (!spec) { if (process.env.NODE_ENV !== 'production') { var typeofSpec = typeof spec; var isMixinValid = typeofSpec === 'object' && spec !== null; process.env.NODE_ENV !== 'production' ? warning(isMixinValid, '%s: You\'re attempting to i...
Mixin helper which handles policy validation and reserved specification keys when building React classes.
mixSpecIntoComponent
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function mixStaticSpecIntoComponent(Constructor, statics) { if (!statics) { return; } for (var name in statics) { var property = statics[name]; if (!statics.hasOwnProperty(name)) { continue; } var isReserved = name in RESERVED_SPEC_KEYS; !!isReserved ? process.env.NODE_ENV...
Mixin helper which handles policy validation and reserved specification keys when building React classes.
mixStaticSpecIntoComponent
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function mergeIntoWithNoDuplicateKeys(one, two) { !(one && two && typeof one === 'object' && typeof two === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.') : _prodInvariant('80') : void 0; for (var key in two) { if (two.hasOwn...
Merge two objects, but throw if both contain the same key. @param {object} one The first object, which is mutated. @param {object} two The second object @return {object} one after it has been mutated to contain everything in two.
mergeIntoWithNoDuplicateKeys
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function createMergedResultFunction(one, two) { return function mergedResult() { var a = one.apply(this, arguments); var b = two.apply(this, arguments); if (a == null) { return b; } else if (b == null) { return a; } var c = {}; mergeIntoWithNoDuplicateKeys(c, a); ...
Creates a function that invokes two functions and merges their return values. @param {function} one Function to invoke first. @param {function} two Function to invoke second. @return {function} Function that invokes the two argument functions. @private
createMergedResultFunction
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function createChainedFunction(one, two) { return function chainedFunction() { one.apply(this, arguments); two.apply(this, arguments); }; }
Creates a function that invokes two functions and ignores their return vales. @param {function} one Function to invoke first. @param {function} two Function to invoke second. @return {function} Function that invokes the two argument functions. @private
createChainedFunction
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function bindAutoBindMethod(component, method) { var boundMethod = method.bind(component); if (process.env.NODE_ENV !== 'production') { boundMethod.__reactBoundContext = component; boundMethod.__reactBoundMethod = method; boundMethod.__reactBoundArguments = null; var componentName = component....
Binds a method to the component. @param {object} component Component whose method is going to be bound. @param {function} method Method to be bound. @return {function} The bound method.
bindAutoBindMethod
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function bindAutoBindMethods(component) { var pairs = component.__reactAutoBindPairs; for (var i = 0; i < pairs.length; i += 2) { var autoBindKey = pairs[i]; var method = pairs[i + 1]; component[autoBindKey] = bindAutoBindMethod(component, method); } }
Binds all auto-bound methods in a component. @param {object} component Component whose method is going to be bound.
bindAutoBindMethods
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function getDeclarationErrorAddendum() { if (ReactCurrentOwner.current) { var name = ReactCurrentOwner.current.getName(); if (name) { return ' Check the render method of `' + name + '`.'; } } return ''; }
ReactElementValidator provides a wrapper around a element factory which validates the props passed to the element. This is intended to be used only in DEV and could be replaced by a static type checker for languages that support it.
getDeclarationErrorAddendum
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function getCurrentComponentErrorInfo(parentType) { var info = getDeclarationErrorAddendum(); if (!info) { var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name; if (parentName) { info = ' Check the top-level render call using <' + parentName + ...
Warn if there's no key explicitly set on dynamic arrays of children or object keys are not valid. This allows us to keep track of children between updates.
getCurrentComponentErrorInfo
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function validateExplicitKey(element, parentType) { if (!element._store || element._store.validated || element.key != null) { return; } element._store.validated = true; var memoizer = ownerHasKeyUseWarning.uniqueKey || (ownerHasKeyUseWarning.uniqueKey = {}); var currentComponentErrorInfo = getCurr...
Warn if the element doesn't have an explicit key assigned to it. This element is in an array. The array could grow and shrink or be reordered. All children that haven't already been validated are required to have a "key" property assigned to it. Error statuses are cached so a warning will only be shown once. @internal...
validateExplicitKey
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function validateChildKeys(node, parentType) { if (typeof node !== 'object') { return; } if (Array.isArray(node)) { for (var i = 0; i < node.length; i++) { var child = node[i]; if (ReactElement.isValidElement(child)) { validateExplicitKey(child, parentType); } } ...
Ensure that every element either is passed in a static location, in an array with an explicit keys property defined, or in an object literal with valid key property. @internal @param {ReactNode} node Statically passed child of any type. @param {*} parentType node's parent's type.
validateChildKeys
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function validatePropTypes(element) { var componentClass = element.type; if (typeof componentClass !== 'function') { return; } var name = componentClass.displayName || componentClass.name; if (componentClass.propTypes) { checkReactTypeSpec(componentClass.propTypes, element.props, 'prop', name, ...
Given an element, validate that its props follow the propTypes definition, provided by the type. @param {ReactElement} element
validatePropTypes
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function checkReactTypeSpec(typeSpecs, values, location, componentName, element, debugID) { for (var typeSpecName in typeSpecs) { if (typeSpecs.hasOwnProperty(typeSpecName)) { var error; // Prop type validation may throw. In case they do, we don't want to // fail the render phase where it d...
Assert that the values match with the type specs. Error messages are memorized and will only be shown once. @param {object} typeSpecs Map of name to a ReactPropType @param {object} values Runtime values that need to be type-checked @param {string} location e.g. "prop", "context", "child context" @param {string} compon...
checkReactTypeSpec
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function PropTypeError(message) { this.message = message; this.stack = ''; }
We use an Error-like object for backward compatibility as people may call PropTypes directly and inspect their output. However we don't use real Errors anymore. We don't inspect their stack anyway, and creating them is prohibitively expensive if they are created too often, such as what happens in oneOfType() for any ty...
PropTypeError
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function createChainableTypeChecker(validate) { if (process.env.NODE_ENV !== 'production') { var manualPropTypeCallCache = {}; } function checkType(isRequired, props, propName, componentName, location, propFullName, secret) { componentName = componentName || ANONYMOUS; propFullName = propFullNam...
We use an Error-like object for backward compatibility as people may call PropTypes directly and inspect their output. However we don't use real Errors anymore. We don't inspect their stack anyway, and creating them is prohibitively expensive if they are created too often, such as what happens in oneOfType() for any ty...
createChainableTypeChecker
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function checkType(isRequired, props, propName, componentName, location, propFullName, secret) { componentName = componentName || ANONYMOUS; propFullName = propFullName || propName; if (process.env.NODE_ENV !== 'production') { if (secret !== ReactPropTypesSecret && typeof console !== 'undefined') ...
We use an Error-like object for backward compatibility as people may call PropTypes directly and inspect their output. However we don't use real Errors anymore. We don't inspect their stack anyway, and creating them is prohibitively expensive if they are created too often, such as what happens in oneOfType() for any ty...
checkType
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function createPrimitiveTypeChecker(expectedType) { function validate(props, propName, componentName, location, propFullName, secret) { var propValue = props[propName]; var propType = getPropType(propValue); if (propType !== expectedType) { var locationName = ReactPropTypeLocationNames[location...
We use an Error-like object for backward compatibility as people may call PropTypes directly and inspect their output. However we don't use real Errors anymore. We don't inspect their stack anyway, and creating them is prohibitively expensive if they are created too often, such as what happens in oneOfType() for any ty...
createPrimitiveTypeChecker
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function validate(props, propName, componentName, location, propFullName, secret) { var propValue = props[propName]; var propType = getPropType(propValue); if (propType !== expectedType) { var locationName = ReactPropTypeLocationNames[location]; // `propValue` being instance of, say, date/r...
We use an Error-like object for backward compatibility as people may call PropTypes directly and inspect their output. However we don't use real Errors anymore. We don't inspect their stack anyway, and creating them is prohibitively expensive if they are created too often, such as what happens in oneOfType() for any ty...
validate
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function createAnyTypeChecker() { return createChainableTypeChecker(emptyFunction.thatReturns(null)); }
We use an Error-like object for backward compatibility as people may call PropTypes directly and inspect their output. However we don't use real Errors anymore. We don't inspect their stack anyway, and creating them is prohibitively expensive if they are created too often, such as what happens in oneOfType() for any ty...
createAnyTypeChecker
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function createArrayOfTypeChecker(typeChecker) { function validate(props, propName, componentName, location, propFullName) { if (typeof typeChecker !== 'function') { return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf...
We use an Error-like object for backward compatibility as people may call PropTypes directly and inspect their output. However we don't use real Errors anymore. We don't inspect their stack anyway, and creating them is prohibitively expensive if they are created too often, such as what happens in oneOfType() for any ty...
createArrayOfTypeChecker
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function validate(props, propName, componentName, location, propFullName) { if (typeof typeChecker !== 'function') { return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.'); } var propValue = props[propName]; ...
We use an Error-like object for backward compatibility as people may call PropTypes directly and inspect their output. However we don't use real Errors anymore. We don't inspect their stack anyway, and creating them is prohibitively expensive if they are created too often, such as what happens in oneOfType() for any ty...
validate
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function createElementTypeChecker() { function validate(props, propName, componentName, location, propFullName) { var propValue = props[propName]; if (!ReactElement.isValidElement(propValue)) { var locationName = ReactPropTypeLocationNames[location]; var propType = getPropType(propValue); ...
We use an Error-like object for backward compatibility as people may call PropTypes directly and inspect their output. However we don't use real Errors anymore. We don't inspect their stack anyway, and creating them is prohibitively expensive if they are created too often, such as what happens in oneOfType() for any ty...
createElementTypeChecker
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function validate(props, propName, componentName, location, propFullName) { var propValue = props[propName]; if (!ReactElement.isValidElement(propValue)) { var locationName = ReactPropTypeLocationNames[location]; var propType = getPropType(propValue); return new PropTypeError('Invalid ' +...
We use an Error-like object for backward compatibility as people may call PropTypes directly and inspect their output. However we don't use real Errors anymore. We don't inspect their stack anyway, and creating them is prohibitively expensive if they are created too often, such as what happens in oneOfType() for any ty...
validate
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function createInstanceTypeChecker(expectedClass) { function validate(props, propName, componentName, location, propFullName) { if (!(props[propName] instanceof expectedClass)) { var locationName = ReactPropTypeLocationNames[location]; var expectedClassName = expectedClass.name || ANONYMOUS; ...
We use an Error-like object for backward compatibility as people may call PropTypes directly and inspect their output. However we don't use real Errors anymore. We don't inspect their stack anyway, and creating them is prohibitively expensive if they are created too often, such as what happens in oneOfType() for any ty...
createInstanceTypeChecker
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function validate(props, propName, componentName, location, propFullName) { if (!(props[propName] instanceof expectedClass)) { var locationName = ReactPropTypeLocationNames[location]; var expectedClassName = expectedClass.name || ANONYMOUS; var actualClassName = getClassName(props[propName]); ...
We use an Error-like object for backward compatibility as people may call PropTypes directly and inspect their output. However we don't use real Errors anymore. We don't inspect their stack anyway, and creating them is prohibitively expensive if they are created too often, such as what happens in oneOfType() for any ty...
validate
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function createEnumTypeChecker(expectedValues) { if (!Array.isArray(expectedValues)) { process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid argument supplied to oneOf, expected an instance of array.') : void 0; return emptyFunction.thatReturnsNull; } function validate(props, propName, com...
We use an Error-like object for backward compatibility as people may call PropTypes directly and inspect their output. However we don't use real Errors anymore. We don't inspect their stack anyway, and creating them is prohibitively expensive if they are created too often, such as what happens in oneOfType() for any ty...
createEnumTypeChecker
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function validate(props, propName, componentName, location, propFullName) { var propValue = props[propName]; for (var i = 0; i < expectedValues.length; i++) { if (is(propValue, expectedValues[i])) { return null; } } var locationName = ReactPropTypeLocationNames[location]; ...
We use an Error-like object for backward compatibility as people may call PropTypes directly and inspect their output. However we don't use real Errors anymore. We don't inspect their stack anyway, and creating them is prohibitively expensive if they are created too often, such as what happens in oneOfType() for any ty...
validate
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function createObjectOfTypeChecker(typeChecker) { function validate(props, propName, componentName, location, propFullName) { if (typeof typeChecker !== 'function') { return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside object...
We use an Error-like object for backward compatibility as people may call PropTypes directly and inspect their output. However we don't use real Errors anymore. We don't inspect their stack anyway, and creating them is prohibitively expensive if they are created too often, such as what happens in oneOfType() for any ty...
createObjectOfTypeChecker
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function validate(props, propName, componentName, location, propFullName) { if (typeof typeChecker !== 'function') { return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.'); } var propValue = props[propName]; ...
We use an Error-like object for backward compatibility as people may call PropTypes directly and inspect their output. However we don't use real Errors anymore. We don't inspect their stack anyway, and creating them is prohibitively expensive if they are created too often, such as what happens in oneOfType() for any ty...
validate
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function createUnionTypeChecker(arrayOfTypeCheckers) { if (!Array.isArray(arrayOfTypeCheckers)) { process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid argument supplied to oneOfType, expected an instance of array.') : void 0; return emptyFunction.thatReturnsNull; } function validate(props...
We use an Error-like object for backward compatibility as people may call PropTypes directly and inspect their output. However we don't use real Errors anymore. We don't inspect their stack anyway, and creating them is prohibitively expensive if they are created too often, such as what happens in oneOfType() for any ty...
createUnionTypeChecker
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function validate(props, propName, componentName, location, propFullName) { for (var i = 0; i < arrayOfTypeCheckers.length; i++) { var checker = arrayOfTypeCheckers[i]; if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) { return null; } ...
We use an Error-like object for backward compatibility as people may call PropTypes directly and inspect their output. However we don't use real Errors anymore. We don't inspect their stack anyway, and creating them is prohibitively expensive if they are created too often, such as what happens in oneOfType() for any ty...
validate
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function createNodeChecker() { function validate(props, propName, componentName, location, propFullName) { if (!isNode(props[propName])) { var locationName = ReactPropTypeLocationNames[location]; return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + c...
We use an Error-like object for backward compatibility as people may call PropTypes directly and inspect their output. However we don't use real Errors anymore. We don't inspect their stack anyway, and creating them is prohibitively expensive if they are created too often, such as what happens in oneOfType() for any ty...
createNodeChecker
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function validate(props, propName, componentName, location, propFullName) { if (!isNode(props[propName])) { var locationName = ReactPropTypeLocationNames[location]; return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a Reac...
We use an Error-like object for backward compatibility as people may call PropTypes directly and inspect their output. However we don't use real Errors anymore. We don't inspect their stack anyway, and creating them is prohibitively expensive if they are created too often, such as what happens in oneOfType() for any ty...
validate
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function createShapeTypeChecker(shapeTypes) { function validate(props, propName, componentName, location, propFullName) { var propValue = props[propName]; var propType = getPropType(propValue); if (propType !== 'object') { var locationName = ReactPropTypeLocationNames[location]; return n...
We use an Error-like object for backward compatibility as people may call PropTypes directly and inspect their output. However we don't use real Errors anymore. We don't inspect their stack anyway, and creating them is prohibitively expensive if they are created too often, such as what happens in oneOfType() for any ty...
createShapeTypeChecker
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function validate(props, propName, componentName, location, propFullName) { var propValue = props[propName]; var propType = getPropType(propValue); if (propType !== 'object') { var locationName = ReactPropTypeLocationNames[location]; return new PropTypeError('Invalid ' + locationName + ' `'...
We use an Error-like object for backward compatibility as people may call PropTypes directly and inspect their output. However we don't use real Errors anymore. We don't inspect their stack anyway, and creating them is prohibitively expensive if they are created too often, such as what happens in oneOfType() for any ty...
validate
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function isNode(propValue) { switch (typeof propValue) { case 'number': case 'string': case 'undefined': return true; case 'boolean': return !propValue; case 'object': if (Array.isArray(propValue)) { return propValue.every(isNode); } if (propValue ...
We use an Error-like object for backward compatibility as people may call PropTypes directly and inspect their output. However we don't use real Errors anymore. We don't inspect their stack anyway, and creating them is prohibitively expensive if they are created too often, such as what happens in oneOfType() for any ty...
isNode
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function isSymbol(propType, propValue) { // Native Symbol. if (propType === 'symbol') { return true; } // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol' if (propValue['@@toStringTag'] === 'Symbol') { return true; } // Fallback for non-spec compliant Symbols which are polyfilled. ...
We use an Error-like object for backward compatibility as people may call PropTypes directly and inspect their output. However we don't use real Errors anymore. We don't inspect their stack anyway, and creating them is prohibitively expensive if they are created too often, such as what happens in oneOfType() for any ty...
isSymbol
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function getPropType(propValue) { var propType = typeof propValue; if (Array.isArray(propValue)) { return 'array'; } if (propValue instanceof RegExp) { // Old webkits (at least until Android 4.0) return 'function' rather than // 'object' for typeof a RegExp. We'll normalize this here so that ...
We use an Error-like object for backward compatibility as people may call PropTypes directly and inspect their output. However we don't use real Errors anymore. We don't inspect their stack anyway, and creating them is prohibitively expensive if they are created too often, such as what happens in oneOfType() for any ty...
getPropType
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function getPreciseType(propValue) { var propType = getPropType(propValue); if (propType === 'object') { if (propValue instanceof Date) { return 'date'; } else if (propValue instanceof RegExp) { return 'regexp'; } } return propType; }
We use an Error-like object for backward compatibility as people may call PropTypes directly and inspect their output. However we don't use real Errors anymore. We don't inspect their stack anyway, and creating them is prohibitively expensive if they are created too often, such as what happens in oneOfType() for any ty...
getPreciseType
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function getClassName(propValue) { if (!propValue.constructor || !propValue.constructor.name) { return ANONYMOUS; } return propValue.constructor.name; }
We use an Error-like object for backward compatibility as people may call PropTypes directly and inspect their output. However we don't use real Errors anymore. We don't inspect their stack anyway, and creating them is prohibitively expensive if they are created too often, such as what happens in oneOfType() for any ty...
getClassName
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function onlyChild(children) { !ReactElement.isValidElement(children) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'React.Children.only expected to receive a single React element child.') : _prodInvariant('143') : void 0; return children; }
Returns the first child in a collection of children and verifies that there is only one child in the collection. See https://facebook.github.io/react/docs/top-level-api.html#react.children.only The current implementation of this function assumes that a single child gets passed without a wrapper, but the purpose of th...
onlyChild
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function shouldPrecacheNode(node, nodeID) { return node.nodeType === 1 && node.getAttribute(ATTR_NAME) === String(nodeID) || node.nodeType === 8 && node.nodeValue === ' react-text: ' + nodeID + ' ' || node.nodeType === 8 && node.nodeValue === ' react-empty: ' + nodeID + ' '; }
Check if a given node should be cached.
shouldPrecacheNode
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function getRenderedHostOrTextFromComponent(component) { var rendered; while (rendered = component._renderedComponent) { component = rendered; } return component; }
Drill down (through composites and empty components) until we get a host or host text component. This is pretty polymorphic but unavoidable with the current structure we have for `_renderedChildren`.
getRenderedHostOrTextFromComponent
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function precacheNode(inst, node) { var hostInst = getRenderedHostOrTextFromComponent(inst); hostInst._hostNode = node; node[internalInstanceKey] = hostInst; }
Populate `_hostNode` on the rendered host/text component with the given DOM node. The passed `inst` can be a composite.
precacheNode
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function uncacheNode(inst) { var node = inst._hostNode; if (node) { delete node[internalInstanceKey]; inst._hostNode = null; } }
Populate `_hostNode` on the rendered host/text component with the given DOM node. The passed `inst` can be a composite.
uncacheNode
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function precacheChildNodes(inst, node) { if (inst._flags & Flags.hasCachedChildNodes) { return; } var children = inst._renderedChildren; var childNode = node.firstChild; outer: for (var name in children) { if (!children.hasOwnProperty(name)) { continue; } var childInst = child...
Populate `_hostNode` on each child of `inst`, assuming that the children match up with the DOM (element) children of `node`. We cache entire levels at once to avoid an n^2 problem where we access the children of a node sequentially and have to walk from the start to our target node every time. Since we update `_rende...
precacheChildNodes
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function getClosestInstanceFromNode(node) { if (node[internalInstanceKey]) { return node[internalInstanceKey]; } // Walk up the tree until we find an ancestor whose instance we have cached. var parents = []; while (!node[internalInstanceKey]) { parents.push(node); if (node.parentNode) { ...
Given a DOM node, return the closest ReactDOMComponent or ReactDOMTextComponent instance ancestor.
getClosestInstanceFromNode
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function getInstanceFromNode(node) { var inst = getClosestInstanceFromNode(node); if (inst != null && inst._hostNode === node) { return inst; } else { return null; } }
Given a DOM node, return the ReactDOMComponent or ReactDOMTextComponent instance, or null if the node was not rendered by this React.
getInstanceFromNode
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function getNodeFromInstance(inst) { // Without this first invariant, passing a non-DOM-component triggers the next // invariant for a missing parent, which is super confusing. !(inst._hostNode !== undefined) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getNodeFromInstance: Invalid argument.') :...
Given a ReactDOMComponent or ReactDOMTextComponent, return the corresponding DOM node.
getNodeFromInstance
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function reactProdInvariant(code) { var argCount = arguments.length - 1; var message = 'Minified React error #' + code + '; visit ' + 'http://facebook.github.io/react/docs/error-decoder.html?invariant=' + code; for (var argIdx = 0; argIdx < argCount; argIdx++) { message += '&args[]=' + encodeURIComponen...
WARNING: DO NOT manually require this module. This is a replacement for `invariant(...)` used by the error code system and will _only_ be required by the corresponding babel pass. It always throws.
reactProdInvariant
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function isPresto() { var opera = window.opera; return typeof opera === 'object' && typeof opera.version === 'function' && parseInt(opera.version(), 10) <= 12; }
Opera <= 12 includes TextEvent in window, but does not fire text input events. Rely on keypress instead.
isPresto
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function isKeypressCommand(nativeEvent) { return (nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) && // ctrlKey && altKey is equivalent to AltGr, and is not a command. !(nativeEvent.ctrlKey && nativeEvent.altKey); }
Return whether a native keypress event is assumed to be a command. This is required because Firefox fires `keypress` events for key commands (cut, copy, select-all, etc.) even though no character is inserted.
isKeypressCommand
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function getCompositionEventType(topLevelType) { switch (topLevelType) { case 'topCompositionStart': return eventTypes.compositionStart; case 'topCompositionEnd': return eventTypes.compositionEnd; case 'topCompositionUpdate': return eventTypes.compositionUpdate; } }
Translate native top level events into event types. @param {string} topLevelType @return {object}
getCompositionEventType
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function isFallbackCompositionStart(topLevelType, nativeEvent) { return topLevelType === 'topKeyDown' && nativeEvent.keyCode === START_KEYCODE; }
Does our fallback best-guess model think this event signifies that composition has begun? @param {string} topLevelType @param {object} nativeEvent @return {boolean}
isFallbackCompositionStart
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function isFallbackCompositionEnd(topLevelType, nativeEvent) { switch (topLevelType) { case 'topKeyUp': // Command keys insert or clear IME input. return END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1; case 'topKeyDown': // Expect IME keyCode on each keydown. If we get any other ...
Does our fallback mode think that this event is the end of composition? @param {string} topLevelType @param {object} nativeEvent @return {boolean}
isFallbackCompositionEnd
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function getDataFromCustomEvent(nativeEvent) { var detail = nativeEvent.detail; if (typeof detail === 'object' && 'data' in detail) { return detail.data; } return null; }
Google Input Tools provides composition data via a CustomEvent, with the `data` property populated in the `detail` object. If this is available on the event object, use it. If not, this is a plain composition event and we have nothing special to extract. @param {object} nativeEvent @return {?string}
getDataFromCustomEvent
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function getNativeBeforeInputChars(topLevelType, nativeEvent) { switch (topLevelType) { case 'topCompositionEnd': return getDataFromCustomEvent(nativeEvent); case 'topKeyPress': /** * If native `textInput` events are available, our goal is to make * use of them. However, there...
@param {string} topLevelType Record from `EventConstants`. @param {object} nativeEvent Native browser event. @return {?string} The string corresponding to this `beforeInput` event.
getNativeBeforeInputChars
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function getFallbackBeforeInputChars(topLevelType, nativeEvent) { // If we are currently composing (IME) and using a fallback to do so, // try to extract the composed characters from the fallback object. // If composition event is available, we extract a string only at // compositionevent, otherwise extract...
For browsers that do not provide the `textInput` event, extract the appropriate string to use for SyntheticInputEvent. @param {string} topLevelType Record from `EventConstants`. @param {object} nativeEvent Native browser event. @return {?string} The fallback string for this `beforeInput` event.
getFallbackBeforeInputChars
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) { var chars; if (canUseTextInputEvent) { chars = getNativeBeforeInputChars(topLevelType, nativeEvent); } else { chars = getFallbackBeforeInputChars(topLevelType, nativeEvent); } // If no characters are ...
Extract a SyntheticInputEvent for `beforeInput`, based on either native `textInput` or fallback behavior. @return {?object} A SyntheticInputEvent.
extractBeforeInputEvent
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function listenerAtPhase(inst, event, propagationPhase) { var registrationName = event.dispatchConfig.phasedRegistrationNames[propagationPhase]; return getListener(inst, registrationName); }
Some event types have a notion of different registration names for different "phases" of propagation. This finds listeners by a given phase.
listenerAtPhase
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function accumulateDirectionalDispatches(inst, phase, event) { if (process.env.NODE_ENV !== 'production') { process.env.NODE_ENV !== 'production' ? warning(inst, 'Dispatching inst must not be null') : void 0; } var listener = listenerAtPhase(inst, event, phase); if (listener) { event._dispatchList...
Tags a `SyntheticEvent` with dispatched listeners. Creating this function here, allows us to not have to bind or create functions for each event. Mutating the event's members allows us to not have to create a wrapping "dispatch" object that pairs the event with the listener.
accumulateDirectionalDispatches
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function accumulateTwoPhaseDispatchesSingle(event) { if (event && event.dispatchConfig.phasedRegistrationNames) { EventPluginUtils.traverseTwoPhase(event._targetInst, accumulateDirectionalDispatches, event); } }
Collect dispatches (must be entirely collected before dispatching - see unit tests). Lazily allocate the array to conserve memory. We must loop through each event and perform the traversal for each one. We cannot perform a single traversal for the entire collection of events because each event may have a different tar...
accumulateTwoPhaseDispatchesSingle
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function accumulateTwoPhaseDispatchesSingleSkipTarget(event) { if (event && event.dispatchConfig.phasedRegistrationNames) { var targetInst = event._targetInst; var parentInst = targetInst ? EventPluginUtils.getParentInstance(targetInst) : null; EventPluginUtils.traverseTwoPhase(parentInst, accumulateD...
Same as `accumulateTwoPhaseDispatchesSingle`, but skips over the targetID.
accumulateTwoPhaseDispatchesSingleSkipTarget
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function accumulateDispatches(inst, ignoredDirection, event) { if (event && event.dispatchConfig.registrationName) { var registrationName = event.dispatchConfig.registrationName; var listener = getListener(inst, registrationName); if (listener) { event._dispatchListeners = accumulateInto(event....
Accumulates without regard to direction, does not look for phased registration names. Same as `accumulateDirectDispatchesSingle` but without requiring that the `dispatchMarker` be the same as the dispatched ID.
accumulateDispatches
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function accumulateDirectDispatchesSingle(event) { if (event && event.dispatchConfig.registrationName) { accumulateDispatches(event._targetInst, null, event); } }
Accumulates dispatches on an `SyntheticEvent`, but only for the `dispatchMarker`. @param {SyntheticEvent} event
accumulateDirectDispatchesSingle
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function accumulateTwoPhaseDispatches(events) { forEachAccumulated(events, accumulateTwoPhaseDispatchesSingle); }
Accumulates dispatches on an `SyntheticEvent`, but only for the `dispatchMarker`. @param {SyntheticEvent} event
accumulateTwoPhaseDispatches
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function accumulateTwoPhaseDispatchesSkipTarget(events) { forEachAccumulated(events, accumulateTwoPhaseDispatchesSingleSkipTarget); }
Accumulates dispatches on an `SyntheticEvent`, but only for the `dispatchMarker`. @param {SyntheticEvent} event
accumulateTwoPhaseDispatchesSkipTarget
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function accumulateEnterLeaveDispatches(leave, enter, from, to) { EventPluginUtils.traverseEnterLeave(from, to, accumulateDispatches, leave, enter); }
Accumulates dispatches on an `SyntheticEvent`, but only for the `dispatchMarker`. @param {SyntheticEvent} event
accumulateEnterLeaveDispatches
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function accumulateDirectDispatches(events) { forEachAccumulated(events, accumulateDirectDispatchesSingle); }
Accumulates dispatches on an `SyntheticEvent`, but only for the `dispatchMarker`. @param {SyntheticEvent} event
accumulateDirectDispatches
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
executeDispatchesAndRelease = function (event, simulated) { if (event) { EventPluginUtils.executeDispatchesInOrder(event, simulated); if (!event.isPersistent()) { event.constructor.release(event); } } }
Dispatches an event and releases it back into the pool, unless persistent. @param {?object} event Synthetic event to be dispatched. @param {boolean} simulated If the event is simulated (changes exn behavior) @private
executeDispatchesAndRelease
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
executeDispatchesAndReleaseSimulated = function (e) { return executeDispatchesAndRelease(e, true); }
Dispatches an event and releases it back into the pool, unless persistent. @param {?object} event Synthetic event to be dispatched. @param {boolean} simulated If the event is simulated (changes exn behavior) @private
executeDispatchesAndReleaseSimulated
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
executeDispatchesAndReleaseTopLevel = function (e) { return executeDispatchesAndRelease(e, false); }
Dispatches an event and releases it back into the pool, unless persistent. @param {?object} event Synthetic event to be dispatched. @param {boolean} simulated If the event is simulated (changes exn behavior) @private
executeDispatchesAndReleaseTopLevel
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
getDictionaryKey = function (inst) { // Prevents V8 performance issue: // https://github.com/facebook/react/pull/7232 return '.' + inst._rootNodeID; }
Dispatches an event and releases it back into the pool, unless persistent. @param {?object} event Synthetic event to be dispatched. @param {boolean} simulated If the event is simulated (changes exn behavior) @private
getDictionaryKey
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function isInteractive(tag) { return tag === 'button' || tag === 'input' || tag === 'select' || tag === 'textarea'; }
Dispatches an event and releases it back into the pool, unless persistent. @param {?object} event Synthetic event to be dispatched. @param {boolean} simulated If the event is simulated (changes exn behavior) @private
isInteractive
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function shouldPreventMouseEvent(name, type, props) { switch (name) { case 'onClick': case 'onClickCapture': case 'onDoubleClick': case 'onDoubleClickCapture': case 'onMouseDown': case 'onMouseDownCapture': case 'onMouseMove': case 'onMouseMoveCapture': case 'onMouseUp': ...
Dispatches an event and releases it back into the pool, unless persistent. @param {?object} event Synthetic event to be dispatched. @param {boolean} simulated If the event is simulated (changes exn behavior) @private
shouldPreventMouseEvent
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function recomputePluginOrdering() { if (!eventPluginOrder) { // Wait until an `eventPluginOrder` is injected. return; } for (var pluginName in namesToPlugins) { var pluginModule = namesToPlugins[pluginName]; var pluginIndex = eventPluginOrder.indexOf(pluginName); !(pluginIndex > -1) ?...
Recomputes the plugin list using the injected plugins and plugin ordering. @private
recomputePluginOrdering
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function publishEventForPlugin(dispatchConfig, pluginModule, eventName) { !!EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same event name, `%s`.', eventName) : _prodInvar...
Publishes an event so that it can be dispatched by the supplied plugin. @param {object} dispatchConfig Dispatch configuration for the event. @param {object} PluginModule Plugin publishing the event. @return {boolean} True if the event was successfully published. @private
publishEventForPlugin
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function publishRegistrationName(registrationName, pluginModule, eventName) { !!EventPluginRegistry.registrationNameModules[registrationName] ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same registration name, `%s`.', registrationName) : _...
Publishes a registration name that is used to identify dispatched events and can be used with `EventPluginHub.putListener` to register listeners. @param {string} registrationName Registration name to add. @param {object} PluginModule Plugin publishing the event. @private
publishRegistrationName
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function isEndish(topLevelType) { return topLevelType === 'topMouseUp' || topLevelType === 'topTouchEnd' || topLevelType === 'topTouchCancel'; }
- `ComponentTree`: [required] Module that can convert between React instances and actual node references.
isEndish
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function isMoveish(topLevelType) { return topLevelType === 'topMouseMove' || topLevelType === 'topTouchMove'; }
- `ComponentTree`: [required] Module that can convert between React instances and actual node references.
isMoveish
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function isStartish(topLevelType) { return topLevelType === 'topMouseDown' || topLevelType === 'topTouchStart'; }
- `ComponentTree`: [required] Module that can convert between React instances and actual node references.
isStartish
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function executeDispatch(event, simulated, listener, inst) { var type = event.type || 'unknown-event'; event.currentTarget = EventPluginUtils.getNodeFromInstance(inst); if (simulated) { ReactErrorUtils.invokeGuardedCallbackWithCatch(type, listener, event); } else { ReactErrorUtils.invokeGuardedCal...
Dispatch the event to the listener. @param {SyntheticEvent} event SyntheticEvent to handle @param {boolean} simulated If the event is simulated (changes exn behavior) @param {function} listener Application-level callback @param {*} inst Internal component instance
executeDispatch
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function executeDispatchesInOrder(event, simulated) { var dispatchListeners = event._dispatchListeners; var dispatchInstances = event._dispatchInstances; if (process.env.NODE_ENV !== 'production') { validateEventDispatches(event); } if (Array.isArray(dispatchListeners)) { for (var i = 0; i < di...
Standard/simple iteration through an event's collected dispatches.
executeDispatchesInOrder
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function executeDispatchesInOrderStopAtTrueImpl(event) { var dispatchListeners = event._dispatchListeners; var dispatchInstances = event._dispatchInstances; if (process.env.NODE_ENV !== 'production') { validateEventDispatches(event); } if (Array.isArray(dispatchListeners)) { for (var i = 0; i <...
Standard/simple iteration through an event's collected dispatches, but stops at the first dispatch execution returning true, and returns that id. @return {?string} id of the first dispatch execution who's listener returns true, or null if no listener returned true.
executeDispatchesInOrderStopAtTrueImpl
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function executeDirectDispatch(event) { if (process.env.NODE_ENV !== 'production') { validateEventDispatches(event); } var dispatchListener = event._dispatchListeners; var dispatchInstance = event._dispatchInstances; !!Array.isArray(dispatchListener) ? process.env.NODE_ENV !== 'production' ? invaria...
Execution of a "direct" dispatch - there must be at most one dispatch accumulated on the event or it is considered an error. It doesn't really make sense for an event with multiple dispatches (bubbled) to keep track of the return values at each dispatch execution, but it does tend to make sense when dealing with "direc...
executeDirectDispatch
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function hasDispatches(event) { return !!event._dispatchListeners; }
@param {SyntheticEvent} event @return {boolean} True iff number of dispatches accumulated is greater than 0.
hasDispatches
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function invokeGuardedCallback(name, func, a) { try { func(a); } catch (x) { if (caughtError === null) { caughtError = x; } } }
Call a function while guarding against errors that happens within it. @param {String} name of the guard to use for logging or debugging @param {Function} func The function to invoke @param {*} a First argument @param {*} b Second argument
invokeGuardedCallback
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function accumulateInto(current, next) { !(next != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'accumulateInto(...): Accumulated items must not be null or undefined.') : _prodInvariant('30') : void 0; if (current == null) { return next; } // Both are not empty. Warning: Never cal...
Accumulates items that must not be null or undefined into the first one. This is used to conserve memory by avoiding array allocations, and thus sacrifices API cleanness. Since `current` can be null before being passed in and not null after this function, make sure to assign it back to `current`: `a = accumulateInto(a...
accumulateInto
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function forEachAccumulated(arr, cb, scope) { if (Array.isArray(arr)) { arr.forEach(cb, scope); } else if (arr) { cb.call(scope, arr); } }
@param {array} arr an "accumulation" of items which is either an Array or a single item. Useful when paired with the `accumulate` module. This is a simple utility that allows us to reason about a collection of items, but handling the case when there is exactly one item (and we do not need to allocate an array).
forEachAccumulated
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
function FallbackCompositionState(root) { this._root = root; this._startText = this.getText(); this._fallbackText = null; }
This helper class stores information about text content of a target node, allowing comparison of content before and after a given event. Identify the node where selection currently begins, then observe both its text content and its current position in the DOM. Since the browser may natively replace the target node dur...
FallbackCompositionState
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
oneArgumentPooler = function (copyFieldsFrom) { var Klass = this; if (Klass.instancePool.length) { var instance = Klass.instancePool.pop(); Klass.call(instance, copyFieldsFrom); return instance; } else { return new Klass(copyFieldsFrom); } }
Static poolers. Several custom versions for each potential number of arguments. A completely generic pooler is easy to implement, but would require accessing the `arguments` object. In each of these, `this` refers to the Class itself, not an instance. If any others are needed, simply add them here, or in their own file...
oneArgumentPooler
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
twoArgumentPooler = function (a1, a2) { var Klass = this; if (Klass.instancePool.length) { var instance = Klass.instancePool.pop(); Klass.call(instance, a1, a2); return instance; } else { return new Klass(a1, a2); } }
Static poolers. Several custom versions for each potential number of arguments. A completely generic pooler is easy to implement, but would require accessing the `arguments` object. In each of these, `this` refers to the Class itself, not an instance. If any others are needed, simply add them here, or in their own file...
twoArgumentPooler
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
threeArgumentPooler = function (a1, a2, a3) { var Klass = this; if (Klass.instancePool.length) { var instance = Klass.instancePool.pop(); Klass.call(instance, a1, a2, a3); return instance; } else { return new Klass(a1, a2, a3); } }
Static poolers. Several custom versions for each potential number of arguments. A completely generic pooler is easy to implement, but would require accessing the `arguments` object. In each of these, `this` refers to the Class itself, not an instance. If any others are needed, simply add them here, or in their own file...
threeArgumentPooler
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT
fourArgumentPooler = function (a1, a2, a3, a4) { var Klass = this; if (Klass.instancePool.length) { var instance = Klass.instancePool.pop(); Klass.call(instance, a1, a2, a3, a4); return instance; } else { return new Klass(a1, a2, a3, a4); } }
Static poolers. Several custom versions for each potential number of arguments. A completely generic pooler is easy to implement, but would require accessing the `arguments` object. In each of these, `this` refers to the Class itself, not an instance. If any others are needed, simply add them here, or in their own file...
fourArgumentPooler
javascript
stitchfix/pyxley
tests/app/static/bundle.js
https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js
MIT