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 spanInPreviousNode(node) { return spanInNode(ts.findPrecedingToken(node.pos, sourceFile)); }
Get the breakpoint span in given sourceFile
spanInPreviousNode
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function spanInNextNode(node) { return spanInNode(ts.findNextToken(node, node.parent)); }
Get the breakpoint span in given sourceFile
spanInNextNode
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function spanInNode(node) { if (node) { if (ts.isExpression(node)) { if (node.parent.kind === 197 /* DoStatement */) { // Set span as if on while keyword return spanInPreviousNode(node); ...
Get the breakpoint span in given sourceFile
spanInNode
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function spanInVariableDeclaration(variableDeclaration) { // If declaration of for in statement, just set the span in parent if (variableDeclaration.parent.parent.kind === 200 /* ForInStatement */ || variableDeclaration.parent.parent.kind === 201 /* ForOfS...
Get the breakpoint span in given sourceFile
spanInVariableDeclaration
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function canHaveSpanInParameterDeclaration(parameter) { // Breakpoint is possible on parameter only if it has initializer, is a rest parameter, or has public or private modifier return !!parameter.initializer || parameter.dotDotDotToken !== undefined || !!...
Get the breakpoint span in given sourceFile
canHaveSpanInParameterDeclaration
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function spanInParameterDeclaration(parameter) { if (canHaveSpanInParameterDeclaration(parameter)) { return textSpan(parameter); } else { var functionDeclaration = parameter.parent; var in...
Get the breakpoint span in given sourceFile
spanInParameterDeclaration
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) { return !!(functionDeclaration.flags & 2 /* Export */) || (functionDeclaration.parent.kind === 214 /* ClassDeclaration */ && functionDeclaration.kind !== 144 /* Constructor */); }
Get the breakpoint span in given sourceFile
canFunctionHaveSpanInWholeDeclaration
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function spanInFunctionDeclaration(functionDeclaration) { // No breakpoints in the function signature if (!functionDeclaration.body) { return undefined; } if (canFunctionHaveSpanInWholeDeclaration(functionDeclaration...
Get the breakpoint span in given sourceFile
spanInFunctionDeclaration
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function spanInFunctionBlock(block) { var nodeForSpanInBlock = block.statements.length ? block.statements[0] : block.getLastToken(); if (canFunctionHaveSpanInWholeDeclaration(block.parent)) { return spanInNodeIfStartsOnSameLine(block.parent, nodeForSpanInB...
Get the breakpoint span in given sourceFile
spanInFunctionBlock
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function spanInBlock(block) { switch (block.parent.kind) { case 218 /* ModuleDeclaration */: if (ts.getModuleInstanceState(block.parent) !== 1 /* Instantiated */) { return undefined; } ...
Get the breakpoint span in given sourceFile
spanInBlock
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function spanInForStatement(forStatement) { if (forStatement.initializer) { if (forStatement.initializer.kind === 212 /* VariableDeclarationList */) { var variableDeclarationList = forStatement.initializer; if (variableD...
Get the breakpoint span in given sourceFile
spanInForStatement
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function spanInCloseBraceToken(node) { switch (node.parent.kind) { case 219 /* ModuleBlock */: // If this is not instantiated module block no bp span if (ts.getModuleInstanceState(node.parent.parent) !== 1 /* Instantiate...
Get the breakpoint span in given sourceFile
spanInCloseBraceToken
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function spanInOpenParenToken(node) { if (node.parent.kind === 197 /* DoStatement */) { // Go to while keyword and do action instead return spanInPreviousNode(node); } // Default to parent node ...
Get the breakpoint span in given sourceFile
spanInOpenParenToken
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function spanInCloseParenToken(node) { // Is this close paren token of parameter list, set span in previous token switch (node.parent.kind) { case 173 /* FunctionExpression */: case 213 /* FunctionDeclaration */: ...
Get the breakpoint span in given sourceFile
spanInCloseParenToken
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function spanInColonToken(node) { // Is this : specifying return annotation of the function declaration if (ts.isFunctionLike(node.parent) || node.parent.kind === 245 /* PropertyAssignment */) { return spanInPreviousNode(node); } ...
Get the breakpoint span in given sourceFile
spanInColonToken
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function spanInGreaterThanOrLessThanToken(node) { if (node.parent.kind === 171 /* TypeAssertionExpression */) { return spanInNode(node.parent.expression); } return spanInNode(node.parent); }
Get the breakpoint span in given sourceFile
spanInGreaterThanOrLessThanToken
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function spanInWhileKeyword(node) { if (node.parent.kind === 197 /* DoStatement */) { // Set span on while expression return textSpan(node, ts.findNextToken(node.parent.expression, node.parent)); } // Default to ...
Get the breakpoint span in given sourceFile
spanInWhileKeyword
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function logInternalError(logger, err) { if (logger) { logger.log("*INTERNAL ERROR* - Exception in typescript services: " + err.message); } }
Get the breakpoint span in given sourceFile
logInternalError
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function ScriptSnapshotShimAdapter(scriptSnapshotShim) { this.scriptSnapshotShim = scriptSnapshotShim; this.lineStartPositions = null; }
Get the breakpoint span in given sourceFile
ScriptSnapshotShimAdapter
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function LanguageServiceShimHostAdapter(shimHost) { var _this = this; this.shimHost = shimHost; this.loggingEnabled = false; this.tracingEnabled = false; // if shimHost is a COM object then property check will become method call with no arguments. ...
Get the breakpoint span in given sourceFile
LanguageServiceShimHostAdapter
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function ThrottledCancellationToken(hostCancellationToken) { this.hostCancellationToken = hostCancellationToken; // Store when we last tried to cancel. Checking cancellation can be expensive (as we have // to marshall over to the host layer). So we only bother actually checking onc...
A cancellation that throttles calls to the host
ThrottledCancellationToken
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function CoreServicesShimHostAdapter(shimHost) { this.shimHost = shimHost; }
A cancellation that throttles calls to the host
CoreServicesShimHostAdapter
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function simpleForwardCall(logger, actionDescription, action, logPerformance) { if (logPerformance) { logger.log(actionDescription); var start = Date.now(); } var result = action(); if (logPerformance) { var end = Date.now(); logger.log(act...
A cancellation that throttles calls to the host
simpleForwardCall
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function forwardJSONCall(logger, actionDescription, action, logPerformance) { try { var result = simpleForwardCall(logger, actionDescription, action, logPerformance); return JSON.stringify({ result: result }); } catch (err) { if (err instanceof ts.OperationCan...
A cancellation that throttles calls to the host
forwardJSONCall
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function ShimBase(factory) { this.factory = factory; factory.registerShim(this); }
A cancellation that throttles calls to the host
ShimBase
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function realizeDiagnostics(diagnostics, newLine) { return diagnostics.map(function (d) { return realizeDiagnostic(d, newLine); }); }
A cancellation that throttles calls to the host
realizeDiagnostics
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function realizeDiagnostic(diagnostic, newLine) { return { message: ts.flattenDiagnosticMessageText(diagnostic.messageText, newLine), start: diagnostic.start, length: diagnostic.length, /// TODO: no need for the tolowerCase call category: ts.Diagnostic...
A cancellation that throttles calls to the host
realizeDiagnostic
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function LanguageServiceShimObject(factory, host, languageService) { _super.call(this, factory); this.host = host; this.languageService = languageService; this.logPerformance = false; this.logger = this.host; }
A cancellation that throttles calls to the host
LanguageServiceShimObject
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function convertClassifications(classifications) { return { spans: classifications.spans.join(","), endOfLineState: classifications.endOfLineState }; }
Return a list of symbols that are interesting to navigate to
convertClassifications
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function ClassifierShimObject(factory, logger) { _super.call(this, factory); this.logger = logger; this.logPerformance = false; this.classifier = ts.createClassifier(); }
Return a list of symbols that are interesting to navigate to
ClassifierShimObject
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function CoreServicesShimObject(factory, logger, host) { _super.call(this, factory); this.logger = logger; this.host = host; this.logPerformance = false; }
Return a list of symbols that are interesting to navigate to
CoreServicesShimObject
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
function TypeScriptServicesFactory() { this._shims = []; }
Return a list of symbols that are interesting to navigate to
TypeScriptServicesFactory
javascript
amol-/dukpy
dukpy/jsmodules/typescriptServices.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/typescriptServices.js
MIT
fileParsedFunc = function (e, root, fullPath) { importManager.queue.splice(importManager.queue.indexOf(path), 1); // Remove the path from the queue var importedEqualsRoot = fullPath === importManager.rootFilename; if (importOptions.optional && e) { callback(null, {ru...
Add an import to be imported @param path - the raw path @param tryAppendLessExtension - whether to try appending the less extension (if the path has no extension) @param currentFileInfo - the current file info (used for instance to work out relative paths) @param importOptions - import options @param callback - callbac...
fileParsedFunc
javascript
amol-/dukpy
dukpy/jsmodules/less/less/import-manager.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/less/less/import-manager.js
MIT
loadFileCallback = function(loadedFile) { var resolvedFilename = loadedFile.filename, contents = loadedFile.contents.replace(/^\uFEFF/, ''); // Pass on an updated rootpath if path of imported file is relative and file // is in a (sub|sup) directory // ...
Add an import to be imported @param path - the raw path @param tryAppendLessExtension - whether to try appending the less extension (if the path has no extension) @param currentFileInfo - the current file info (used for instance to work out relative paths) @param importOptions - import options @param callback - callbac...
loadFileCallback
javascript
amol-/dukpy
dukpy/jsmodules/less/less/import-manager.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/less/less/import-manager.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
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.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
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function getCompositionEventType(topLevelType) { switch (topLevelType) { case topLevelTypes.topCompositionStart: return eventTypes.compositionStart; case topLevelTypes.topCompositionEnd: return eventTypes.compositionEnd; case topLevelTypes.topCompositionUpdate: return eventTypes.composit...
Translate native top level events into event types. @param {string} topLevelType @return {object}
getCompositionEventType
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function isFallbackCompositionStart(topLevelType, nativeEvent) { return topLevelType === topLevelTypes.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
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function isFallbackCompositionEnd(topLevelType, nativeEvent) { switch (topLevelType) { case topLevelTypes.topKeyUp: // Command keys insert or clear IME input. return END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1; case topLevelTypes.topKeyDown: // Expect IME keyCode on each keydown. If we ...
Does our fallback mode think that this event is the end of composition? @param {string} topLevelType @param {object} nativeEvent @return {boolean}
isFallbackCompositionEnd
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.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
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function extractCompositionEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) { var eventType; var fallbackData; if (canUseCompositionEvent) { eventType = getCompositionEventType(topLevelType); } else if (!currentComposition) { if (isFallbackCompositionStart(topLevelT...
@param {string} topLevelType Record from `EventConstants`. @param {DOMEventTarget} topLevelTarget The listening component root node. @param {string} topLevelTargetID ID of `topLevelTarget`. @param {object} nativeEvent Native browser event. @return {?object} A SyntheticCompositionEvent.
extractCompositionEvent
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function getNativeBeforeInputChars(topLevelType, nativeEvent) { switch (topLevelType) { case topLevelTypes.topCompositionEnd: return getDataFromCustomEvent(nativeEvent); case topLevelTypes.topKeyPress: /** * If native `textInput` events are available, our goal is to make * use of the...
@param {string} topLevelType Record from `EventConstants`. @param {object} nativeEvent Native browser event. @return {?string} The string corresponding to this `beforeInput` event.
getNativeBeforeInputChars
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.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 (currentComposition) { if (topLevelType === topLevelTypes.topCompositionEnd || isFallbackCompositionEnd...
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
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function extractBeforeInputEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) { var chars; if (canUseTextInputEvent) { chars = getNativeBeforeInputChars(topLevelType, nativeEvent); } else { chars = getFallbackBeforeInputChars(topLevelType, nativeEvent); } // If no ...
Extract a SyntheticInputEvent for `beforeInput`, based on either native `textInput` or fallback behavior. @param {string} topLevelType Record from `EventConstants`. @param {DOMEventTarget} topLevelTarget The listening component root node. @param {string} topLevelTargetID ID of `topLevelTarget`. @param {object} nativeE...
extractBeforeInputEvent
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function prefixKey(prefix, key) { return prefix + key.charAt(0).toUpperCase() + key.substring(1); }
@param {string} prefix vendor-specific prefix, eg: Webkit @param {string} key style name, eg: transitionDuration @return {string} style name prefixed with `prefix`, properly camelCased, eg: WebkitTransitionDuration
prefixKey
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function CallbackQueue() { this._callbacks = null; this._contexts = null; }
A specialized pseudo-event module to help keep track of components waiting to be notified when their DOM representations are available for use. This implements `PooledClass`, so you should never need to instantiate this. Instead, use `CallbackQueue.getPooled()`. @class ReactMountReady @implements PooledClass @interna...
CallbackQueue
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function startWatchingForValueChange(target, targetID) { activeElement = target; activeElementID = targetID; activeElementValue = target.value; activeElementValueProp = Object.getOwnPropertyDescriptor(target.constructor.prototype, 'value'); // Not guarded in a canDefineProperty check: IE8 supports defineProp...
(For old IE.) Starts tracking propertychange events on the passed-in element and override the value property so that we can distinguish user events from value changes in JS.
startWatchingForValueChange
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function stopWatchingForValueChange() { if (!activeElement) { return; } // delete restores the original property definition delete activeElement.value; activeElement.detachEvent('onpropertychange', handlePropertyChange); activeElement = null; activeElementID = null; activeElementValue = null; ac...
(For old IE.) Removes the event listeners from the currently-tracked element, if any exists.
stopWatchingForValueChange
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function handlePropertyChange(nativeEvent) { if (nativeEvent.propertyName !== 'value') { return; } var value = nativeEvent.srcElement.value; if (value === activeElementValue) { return; } activeElementValue = value; manualDispatchChangeEvent(nativeEvent); }
(For old IE.) Handles a propertychange event, sending a `change` event if the value of the active element has changed.
handlePropertyChange
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function getTargetIDForInputEvent(topLevelType, topLevelTarget, topLevelTargetID) { if (topLevelType === topLevelTypes.topInput) { // In modern browsers (i.e., not IE8 or IE9), the input event is exactly // what we want so fall through here and trigger an abstract event return topLevelTargetID; } }
If a `change` event should be fired, returns the target's ID.
getTargetIDForInputEvent
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function handleEventsForInputEventIE(topLevelType, topLevelTarget, topLevelTargetID) { if (topLevelType === topLevelTypes.topFocus) { // In IE8, we can capture almost all .value changes by adding a // propertychange handler and looking for events with propertyName // equal to 'value' // In IE9, proper...
If a `change` event should be fired, returns the target's ID.
handleEventsForInputEventIE
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function getTargetIDForInputEventIE(topLevelType, topLevelTarget, topLevelTargetID) { if (topLevelType === topLevelTypes.topSelectionChange || topLevelType === topLevelTypes.topKeyUp || topLevelType === topLevelTypes.topKeyDown) { // On the selectionchange event, the target is just document which isn't // hel...
If a `change` event should be fired, returns the target's ID.
getTargetIDForInputEventIE
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function insertChildAt(parentNode, childNode, index) { // By exploiting arrays returning `undefined` for an undefined index, we can // rely exclusively on `insertBefore(node, null)` instead of also using // `appendChild(node)`. However, using `undefined` is not allowed by all // browsers so we must replace it w...
Inserts `childNode` as a child of `parentNode` at the `index`. @param {DOMElement} parentNode Parent node in which to insert. @param {DOMElement} childNode Child node to insert. @param {number} index Index at which to insert the child. @internal
insertChildAt
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function getNodeName(markup) { return markup.substring(1, markup.indexOf(' ')); }
Extracts the `nodeName` from a string of markup. NOTE: Extracting the `nodeName` does not require a regular expression match because we make assumptions about React-generated markup (i.e. there are no spaces surrounding the opening tag and there is at least one attribute). @param {string} markup String of markup. @re...
getNodeName
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.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
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.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
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.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
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function validateInstanceHandle() { var valid = InstanceHandle && InstanceHandle.traverseTwoPhase && InstanceHandle.traverseEnterLeave; "development" !== 'production' ? warning(valid, 'InstanceHandle not injected before use!') : undefined; }
- `InstanceHandle`: [required] Module that performs logical traversals of DOM hierarchy given ids of the logical DOM elements involved.
validateInstanceHandle
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.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) ? "develo...
Recomputes the plugin list using the injected plugins and plugin ordering. @private
recomputePluginOrdering
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function publishEventForPlugin(dispatchConfig, PluginModule, eventName) { !!EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName) ? "development" !== 'production' ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same ' + 'event name, `%s`.', eventName) : invariant(fal...
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
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function publishRegistrationName(registrationName, PluginModule, eventName) { !!EventPluginRegistry.registrationNameModules[registrationName] ? "development" !== 'production' ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same ' + 'registration name, `%s`.', registrationName) : inva...
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
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function isEndish(topLevelType) { return topLevelType === topLevelTypes.topMouseUp || topLevelType === topLevelTypes.topTouchEnd || topLevelType === topLevelTypes.topTouchCancel; }
- `Mount`: [required] Module that can convert between React dom IDs and actual node references.
isEndish
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function isMoveish(topLevelType) { return topLevelType === topLevelTypes.topMouseMove || topLevelType === topLevelTypes.topTouchMove; }
- `Mount`: [required] Module that can convert between React dom IDs and actual node references.
isMoveish
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function isStartish(topLevelType) { return topLevelType === topLevelTypes.topMouseDown || topLevelType === topLevelTypes.topTouchStart; }
- `Mount`: [required] Module that can convert between React dom IDs and actual node references.
isStartish
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function executeDispatch(event, simulated, listener, domID) { var type = event.type || 'unknown-event'; event.currentTarget = injection.Mount.getNode(domID); if (simulated) { ReactErrorUtils.invokeGuardedCallbackWithCatch(type, listener, event, domID); } else { ReactErrorUtils.invokeGuardedCallback(type...
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 {string} domID DOM id to pass to the callback.
executeDispatch
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function executeDispatchesInOrder(event, simulated) { var dispatchListeners = event._dispatchListeners; var dispatchIDs = event._dispatchIDs; if ("development" !== 'production') { validateEventDispatches(event); } if (Array.isArray(dispatchListeners)) { for (var i = 0; i < dispatchListeners.length; i+...
Standard/simple iteration through an event's collected dispatches.
executeDispatchesInOrder
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function executeDispatchesInOrderStopAtTrueImpl(event) { var dispatchListeners = event._dispatchListeners; var dispatchIDs = event._dispatchIDs; if ("development" !== 'production') { validateEventDispatches(event); } if (Array.isArray(dispatchListeners)) { for (var i = 0; i < dispatchListeners.length;...
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
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function executeDirectDispatch(event) { if ("development" !== 'production') { validateEventDispatches(event); } var dispatchListener = event._dispatchListeners; var dispatchID = event._dispatchIDs; !!Array.isArray(dispatchListener) ? "development" !== 'production' ? invariant(false, 'executeDirectDispatch...
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
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.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
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function listenerAtPhase(id, event, propagationPhase) { var registrationName = event.dispatchConfig.phasedRegistrationNames[propagationPhase]; return getListener(id, 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
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function accumulateDirectionalDispatches(domID, upwards, event) { if ("development" !== 'production') { "development" !== 'production' ? warning(domID, 'Dispatching id must not be null') : undefined; } var phase = upwards ? PropagationPhases.bubbled : PropagationPhases.captured; var listener = listenerAtPha...
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
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function accumulateTwoPhaseDispatchesSingle(event) { if (event && event.dispatchConfig.phasedRegistrationNames) { EventPluginHub.injection.getInstanceHandle().traverseTwoPhase(event.dispatchMarker, 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
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function accumulateTwoPhaseDispatchesSingleSkipTarget(event) { if (event && event.dispatchConfig.phasedRegistrationNames) { EventPluginHub.injection.getInstanceHandle().traverseTwoPhaseSkipTarget(event.dispatchMarker, accumulateDirectionalDispatches, event); } }
Same as `accumulateTwoPhaseDispatchesSingle`, but skips over the targetID.
accumulateTwoPhaseDispatchesSingleSkipTarget
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function accumulateDispatches(id, ignoredDirection, event) { if (event && event.dispatchConfig.registrationName) { var registrationName = event.dispatchConfig.registrationName; var listener = getListener(id, registrationName); if (listener) { event._dispatchListeners = accumulateInto(event._dispatch...
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
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function accumulateDirectDispatchesSingle(event) { if (event && event.dispatchConfig.registrationName) { accumulateDispatches(event.dispatchMarker, null, event); } }
Accumulates dispatches on an `SyntheticEvent`, but only for the `dispatchMarker`. @param {SyntheticEvent} event
accumulateDirectDispatchesSingle
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function accumulateTwoPhaseDispatches(events) { forEachAccumulated(events, accumulateTwoPhaseDispatchesSingle); }
Accumulates dispatches on an `SyntheticEvent`, but only for the `dispatchMarker`. @param {SyntheticEvent} event
accumulateTwoPhaseDispatches
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function accumulateTwoPhaseDispatchesSkipTarget(events) { forEachAccumulated(events, accumulateTwoPhaseDispatchesSingleSkipTarget); }
Accumulates dispatches on an `SyntheticEvent`, but only for the `dispatchMarker`. @param {SyntheticEvent} event
accumulateTwoPhaseDispatchesSkipTarget
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function accumulateEnterLeaveDispatches(leave, enter, fromID, toID) { EventPluginHub.injection.getInstanceHandle().traverseEnterLeave(fromID, toID, accumulateDispatches, leave, enter); }
Accumulates dispatches on an `SyntheticEvent`, but only for the `dispatchMarker`. @param {SyntheticEvent} event
accumulateEnterLeaveDispatches
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function accumulateDirectDispatches(events) { forEachAccumulated(events, accumulateDirectDispatchesSingle); }
Accumulates dispatches on an `SyntheticEvent`, but only for the `dispatchMarker`. @param {SyntheticEvent} event
accumulateDirectDispatches
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.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
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.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
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.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
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.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
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.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
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
fiveArgumentPooler = function (a1, a2, a3, a4, a5) { var Klass = this; if (Klass.instancePool.length) { var instance = Klass.instancePool.pop(); Klass.call(instance, a1, a2, a3, a4, a5); return instance; } else { return new Klass(a1, a2, a3, a4, a5); } }
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...
fiveArgumentPooler
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
standardReleaser = function (instance) { var Klass = this; !(instance instanceof Klass) ? "development" !== 'production' ? invariant(false, 'Trying to release an instance into a pool of a different type.') : invariant(false) : undefined; instance.destructor(); if (Klass.instancePool.length < Klass.poolSize) { ...
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...
standardReleaser
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
addPoolingTo = function (CopyConstructor, pooler) { var NewKlass = CopyConstructor; NewKlass.instancePool = []; NewKlass.getPooled = pooler || DEFAULT_POOLER; if (!NewKlass.poolSize) { NewKlass.poolSize = DEFAULT_POOL_SIZE; } NewKlass.release = standardReleaser; return NewKlass; }
Augments `CopyConstructor` to be a poolable class, augmenting only the class itself (statically) not adding any prototypical fields. Any CopyConstructor you give this may have a `poolSize` property, and will look for a prototypical `destructor` on instances (optional). @param {Function} CopyConstructor Constructor tha...
addPoolingTo
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function getListeningForDocument(mountAt) { // In IE8, `mountAt` is a host object and doesn't have `hasOwnProperty` // directly. if (!Object.prototype.hasOwnProperty.call(mountAt, topListenersIDKey)) { mountAt[topListenersIDKey] = reactTopListenersCounter++; alreadyListeningTo[mountAt[topListenersIDKey]] ...
To ensure no conflicts with other potential React instances on the page
getListeningForDocument
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function ForEachBookKeeping(forEachFunction, forEachContext) { this.func = forEachFunction; this.context = forEachContext; this.count = 0; }
PooledClass representing the bookkeeping associated with performing a child traversal. Allows avoiding binding callbacks. @constructor ForEachBookKeeping @param {!function} forEachFunction Function to perform traversal with. @param {?*} forEachContext Context to perform context with.
ForEachBookKeeping
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function forEachSingleChild(bookKeeping, child, name) { var func = bookKeeping.func; var context = bookKeeping.context; func.call(context, child, bookKeeping.count++); }
PooledClass representing the bookkeeping associated with performing a child traversal. Allows avoiding binding callbacks. @constructor ForEachBookKeeping @param {!function} forEachFunction Function to perform traversal with. @param {?*} forEachContext Context to perform context with.
forEachSingleChild
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function forEachChildren(children, forEachFunc, forEachContext) { if (children == null) { return children; } var traverseContext = ForEachBookKeeping.getPooled(forEachFunc, forEachContext); traverseAllChildren(children, forEachSingleChild, traverseContext); ForEachBookKeeping.release(traverseContext); }
Iterates through children that are typically specified as `props.children`. The provided forEachFunc(child, index) will be called for each leaf child. @param {?*} children Children tree container. @param {function(*, int)} forEachFunc @param {*} forEachContext Context for forEachContext.
forEachChildren
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function MapBookKeeping(mapResult, keyPrefix, mapFunction, mapContext) { this.result = mapResult; this.keyPrefix = keyPrefix; this.func = mapFunction; this.context = mapContext; this.count = 0; }
PooledClass representing the bookkeeping associated with performing a child mapping. Allows avoiding binding callbacks. @constructor MapBookKeeping @param {!*} mapResult Object containing the ordered map of results. @param {!function} mapFunction Function to perform mapping with. @param {?*} mapContext Context to perf...
MapBookKeeping
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function mapSingleChildIntoContext(bookKeeping, child, childKey) { var result = bookKeeping.result; var keyPrefix = bookKeeping.keyPrefix; var func = bookKeeping.func; var context = bookKeeping.context; var mappedChild = func.call(context, child, bookKeeping.count++); if (Array.isArray(mappedChild)) { ...
PooledClass representing the bookkeeping associated with performing a child mapping. Allows avoiding binding callbacks. @constructor MapBookKeeping @param {!*} mapResult Object containing the ordered map of results. @param {!function} mapFunction Function to perform mapping with. @param {?*} mapContext Context to perf...
mapSingleChildIntoContext
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) { var escapedPrefix = ''; if (prefix != null) { escapedPrefix = escapeUserProvidedKey(prefix) + '/'; } var traverseContext = MapBookKeeping.getPooled(array, escapedPrefix, func, context); traverseAllChildren(children, mapSingleC...
PooledClass representing the bookkeeping associated with performing a child mapping. Allows avoiding binding callbacks. @constructor MapBookKeeping @param {!*} mapResult Object containing the ordered map of results. @param {!function} mapFunction Function to perform mapping with. @param {?*} mapContext Context to perf...
mapIntoWithKeyPrefixInternal
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function mapChildren(children, func, context) { if (children == null) { return children; } var result = []; mapIntoWithKeyPrefixInternal(children, result, null, func, context); return result; }
Maps children that are typically specified as `props.children`. The provided mapFunction(child, key, index) will be called for each leaf child. @param {?*} children Children tree container. @param {function(*, int)} func The map function. @param {*} context Context for mapFunction. @return {object} Object containing ...
mapChildren
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function forEachSingleChildDummy(traverseContext, child, name) { return null; }
Maps children that are typically specified as `props.children`. The provided mapFunction(child, key, index) will be called for each leaf child. @param {?*} children Children tree container. @param {function(*, int)} func The map function. @param {*} context Context for mapFunction. @return {object} Object containing ...
forEachSingleChildDummy
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function countChildren(children, context) { return traverseAllChildren(children, forEachSingleChildDummy, null); }
Count the number of children that are typically specified as `props.children`. @param {?*} children Children tree container. @return {number} The number of children.
countChildren
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function toArray(children) { var result = []; mapIntoWithKeyPrefixInternal(children, result, null, emptyFunction.thatReturnsArgument); return result; }
Flatten a children object (typically specified as `props.children`) and return an array with appropriately re-keyed children.
toArray
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function warnSetProps() { if (!warnedSetProps) { warnedSetProps = true; "development" !== 'production' ? warning(false, 'setProps(...) and replaceProps(...) are deprecated. ' + 'Instead, call render again at the top level.') : undefined; } }
These methods are similar to DEFINE_MANY, except we assume they return objects. We try to merge the keys of the return values of all the mixed in functions. If there is a key conflict we throw.
warnSetProps
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.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 not in __DEV__ "development" !== 'production' ? warning(typeof typeDef[propName] ...
Special case getDefaultProps which should move into statics but requires automatic merging.
validateTypeDef
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT