@samitouri / QOS-React-2 / commits / 0937e918aa

jsdoc fixes

Henry Zhu committed Feb 5, 2015 at 08:14 UTC 0937e918aac558e54b38245a617881a9b230668a
22 files changed +54 -43
src/browser/eventPlugins/SelectEventPlugin.js
+1 -1
@@ -58,7 +58,7 @@ var ON_SELECT_KEY = keyOf({onSelect: null});
58 * two identical selections on the same node will return identical objects.
59 *
60 * @param {DOMElement} node
61 - * @param {object}
61 + * @return {object}
62 */
63 function getSelection(node) {
64 if ('selectionStart' in node &&
src/browser/eventPlugins/SimpleEventPlugin.js
+2 -2
@@ -302,8 +302,8 @@ var SimpleEventPlugin = {
302 * Same as the default implementation, except cancels the event when return
303 * value is false. This behavior will be disabled in a future release.
304 *
305 - * @param {object} Event to be dispatched.
306 - * @param {function} Application-level callback.
305 + * @param {object} event Event to be dispatched.
306 + * @param {function} listener Application-level callback.
307 * @param {string} domID DOM ID to pass to the callback.
308 */
309 executeDispatch: function(event, listener, domID) {
src/browser/findDOMNode.js
+1 -1
@@ -24,7 +24,7 @@ var warning = require('warning');
24 * Returns the DOM node rendered by this element.
25 *
26 * @param {ReactComponent|DOMElement} componentOrElement
27 - * @return {DOMElement} The root node of this element.
27 + * @return {?DOMElement} The root node of this element.
28 */
29 function findDOMNode(componentOrElement) {
30 if (__DEV__) {
src/browser/ui/ReactDOMComponent.js
+1
@@ -88,6 +88,7 @@ function checkAndWarnForMutatedStyle(style1, style2, component) {
88 var BackendIDOperations = null;
89
90 /**
91 + * @param {object} component
92 * @param {?object} props
93 */
94 function assertValidProps(component, props) {
src/browser/ui/ReactEventListener.js
+2 -2
@@ -116,7 +116,7 @@ var ReactEventListener = {
116 * @param {string} topLevelType Record from `EventConstants`.
117 * @param {string} handlerBaseName Event name (e.g. "click").
118 * @param {object} handle Element on which to attach listener.
119 - * @return {object} An object with a remove function which will forcefully
119 + * @return {?object} An object with a remove function which will forcefully
120 * remove the listener.
121 * @internal
122 */
@@ -138,7 +138,7 @@ var ReactEventListener = {
138 * @param {string} topLevelType Record from `EventConstants`.
139 * @param {string} handlerBaseName Event name (e.g. "click").
140 * @param {object} handle Element on which to attach listener.
141 - * @return {object} An object with a remove function which will forcefully
141 + * @return {?object} An object with a remove function which will forcefully
142 * remove the listener.
143 * @internal
144 */
src/browser/ui/ReactMount.js
+1 -1
@@ -617,7 +617,7 @@ var ReactMount = {
617 * Constructs a component instance of `constructor` with `initialProps` and
618 * renders it into a container node identified by supplied `id`.
619 *
620 - * @param {function} componentConstructor React component constructor
620 + * @param {function} constructor React component constructor
621 * @param {?object} props Initial props of the component instance.
622 * @param {string} id ID of the DOM element to render into.
623 * @return {ReactComponent} Component instance rendered in the container node.
src/browser/ui/dom/getEventCharCode.js
+1 -1
@@ -20,7 +20,7 @@
20 * presumably because it does not produce a tab-character in browsers.
21 *
22 * @param {object} nativeEvent Native browser event.
23 - * @return {string} Normalized `charCode` property.
23 + * @return {number} Normalized `charCode` property.
24 */
25 function getEventCharCode(nativeEvent) {
26 var charCode;
src/classic/element/ReactElement.js
+4 -2
@@ -64,7 +64,7 @@ var useMutationMembrane = false;
64 * Warn for mutations.
65 *
66 * @internal
67 - * @param {object} element
67 + * @param {object} prototype
68 */
69 function defineMutationMembrane(prototype) {
70 try {
@@ -85,8 +85,10 @@ function defineMutationMembrane(prototype) {
85 * work with a dynamic instanceof check. Nothing should live on this prototype.
86 *
87 * @param {*} type
88 - * @param {string|object} ref
88 * @param {*} key
89 + * @param {string|object} ref
90 + * @param {*} owner
91 + * @param {*} context
92 * @param {*} props
93 * @internal
94 */
src/core/ReactInstanceHandles.js
+1
@@ -168,6 +168,7 @@ function getFirstCommonAncestorID(oneID, twoID) {
168 * @param {?string} start ID at which to start traversal.
169 * @param {?string} stop ID at which to end traversal.
170 * @param {function} cb Callback to invoke each ID with.
171 + * @param {*} arg Argument to invoke the callback with.
172 * @param {?boolean} skipFirst Whether or not to skip the first node.
173 * @param {?boolean} skipLast Whether or not to skip the last node.
174 * @private
src/event/EventPluginUtils.js
+6 -6
@@ -102,8 +102,8 @@ function forEachEventDispatch(event, cb) {
102
103 /**
104 * Default implementation of PluginModule.executeDispatch().
105 - * @param {SyntheticEvent} SyntheticEvent to handle
106 - * @param {function} Application-level callback
105 + * @param {SyntheticEvent} event SyntheticEvent to handle
106 + * @param {function} listener Application-level callback
107 * @param {string} domID DOM id to pass to the callback.
108 */
109 function executeDispatch(event, listener, domID) {
@@ -126,8 +126,8 @@ function executeDispatchesInOrder(event, cb) {
126 * Standard/simple iteration through an event's collected dispatches, but stops
127 * at the first dispatch execution returning true, and returns that id.
128 *
129 - * @return id of the first dispatch execution who's listener returns true, or
130 - * null if no listener returned true.
129 + * @return {?string} id of the first dispatch execution who's listener returns
130 + * true, or null if no listener returned true.
131 */
132 function executeDispatchesInOrderStopAtTrueImpl(event) {
133 var dispatchListeners = event._dispatchListeners;
@@ -170,7 +170,7 @@ function executeDispatchesInOrderStopAtTrue(event) {
170 * return values at each dispatch execution, but it does tend to make sense when
171 * dealing with "direct" dispatches.
172 *
173 - * @return The return value of executing the single dispatch.
173 + * @return {*} The return value of executing the single dispatch.
174 */
175 function executeDirectDispatch(event) {
176 if (__DEV__) {
@@ -192,7 +192,7 @@ function executeDirectDispatch(event) {
192
193 /**
194 * @param {SyntheticEvent} event
195 - * @return {bool} True iff number of dispatches accumulated is greater than 0.
195 + * @return {boolean} True iff number of dispatches accumulated is greater than 0.
196 */
197 function hasDispatches(event) {
198 return !!event._dispatchListeners;
src/event/eventPlugins/ResponderEventPlugin.js
+1 -1
@@ -437,7 +437,7 @@ function canTriggerTransfer(topLevelType, topLevelTargetID) {
437 * longer any touches that started inside of the current `responderID`.
438 *
439 * @param {NativeEvent} nativeEvent Native touch end event.
440 - * @return {bool} Whether or not this touch end event ends the responder.
440 + * @return {boolean} Whether or not this touch end event ends the responder.
441 */
442 function noResponderTouches(nativeEvent) {
443 var touches = nativeEvent.touches;
src/event/eventPlugins/__tests__/ResponderEventPlugin-test.js
+2 -1
@@ -206,7 +206,8 @@ var oneEventLoopTestConfig = function(readableIDToID) {
206 };
207
208 /**
209 - * @param {object} sequence See `oneEventLoopTestConfig`.
209 + * @param {object} eventTestConfig
210 + * @param {object} readableIDToID
211 */
212 var registerTestHandlers = function(eventTestConfig, readableIDToID) {
213 var runs = {dispatchCount: 0};
src/test/ReactTestUtils.js
+8 -8
@@ -151,7 +151,7 @@ var ReactTestUtils = {
151 /**
152 * Finds all instance of components in the rendered tree that are DOM
153 * components with the class name matching `className`.
154 - * @return an array of all the matches.
154 + * @return {array} an array of all the matches.
155 */
156 scryRenderedDOMComponentsWithClass: function(root, className) {
157 return ReactTestUtils.findAllInRenderedTree(root, function(inst) {
@@ -184,7 +184,7 @@ var ReactTestUtils = {
184 /**
185 * Finds all instance of components in the rendered tree that are DOM
186 * components with the tag name matching `tagName`.
187 - * @return an array of all the matches.
187 + * @return {array} an array of all the matches.
188 */
189 scryRenderedDOMComponentsWithTag: function(root, tagName) {
190 return ReactTestUtils.findAllInRenderedTree(root, function(inst) {
@@ -210,7 +210,7 @@ var ReactTestUtils = {
210
211 /**
212 * Finds all instances of components with type equal to `componentType`.
213 - * @return an array of all the matches.
213 + * @return {array} an array of all the matches.
214 */
215 scryRenderedComponentsWithType: function(root, componentType) {
216 return ReactTestUtils.findAllInRenderedTree(root, function(inst) {
@@ -270,7 +270,7 @@ var ReactTestUtils = {
270 /**
271 * Simulates a top level event being dispatched from a raw event that occured
272 * on an `Element` node.
273 - * @param topLevelType {Object} A type from `EventConstants.topLevelTypes`
273 + * @param {Object} topLevelType A type from `EventConstants.topLevelTypes`
274 * @param {!Element} node The dom to simulate an event occurring on.
275 * @param {?Event} fakeNativeEvent Fake native event to use in SyntheticEvent.
276 */
@@ -285,8 +285,8 @@ var ReactTestUtils = {
285 /**
286 * Simulates a top level event being dispatched from a raw event that occured
287 * on the `ReactDOMComponent` `comp`.
288 - * @param topLevelType {Object} A type from `EventConstants.topLevelTypes`.
289 - * @param comp {!ReactDOMComponent}
288 + * @param {Object} topLevelType A type from `EventConstants.topLevelTypes`.
289 + * @param {!ReactDOMComponent} comp
290 * @param {?Event} fakeNativeEvent Fake native event to use in SyntheticEvent.
291 */
292 simulateNativeEventOnDOMComponent: function(
@@ -448,7 +448,7 @@ function buildSimulators() {
448 var eventType;
449 for (eventType in ReactBrowserEventEmitter.eventNameDispatchConfigs) {
450 /**
451 - * @param {!Element || ReactDOMComponent} domComponentOrNode
451 + * @param {!Element|ReactDOMComponent} domComponentOrNode
452 * @param {?object} eventData Fake event data to use in SyntheticEvent.
453 */
454 ReactTestUtils.Simulate[eventType] = makeSimulator(eventType);
@@ -512,7 +512,7 @@ for (eventType in topLevelTypes) {
512 var convenienceName = eventType.indexOf('top') === 0 ?
513 eventType.charAt(3).toLowerCase() + eventType.substr(4) : eventType;
514 /**
515 - * @param {!Element || ReactDOMComponent} domComponentOrNode
515 + * @param {!Element|ReactDOMComponent} domComponentOrNode
516 * @param {?Event} nativeEventData Fake native event to use in SyntheticEvent.
517 */
518 ReactTestUtils.SimulateNative[convenienceName] =
src/test/mocks.js
+1 -1
@@ -374,7 +374,7 @@ module.exports = {
374 *
375 * defines an object with a slot named 'self' that refers back to the object.
376 *
377 - * @param component The component for which to retrieve metadata.
377 + * @param {*} component The component for which to retrieve metadata.
378 */
379 getMetadata: function(component) {
380 var metadata = _getMetadata(component);
src/utils/OrderedMap.js
+3 -4
@@ -97,7 +97,7 @@ function assertValidPublicKey(key) {
97 * @param {number} length Length of range.
98 * @param {number} actualLen Actual length of range that should not be
99 * exceeded.
100 - * @return {void} description
100 + * @throws Error if range arguments are out of bounds.
101 */
102 function assertValidRangeIndices(start, length, actualLen) {
103 invariant(
@@ -227,7 +227,7 @@ var OrderedMapMethods = {
227 *
228 * @param {Function} cb Determines result for each item.
229 * @param {number} start Start index of map range.
230 - * @param {end} end End index of map range.
230 + * @param {end} length End index of map range.
231 * @param {*!?} context Context of callback invocation.
232 * @return {OrderedMap} OrderedMap resulting from mapping the range.
233 */
@@ -269,7 +269,7 @@ var OrderedMapMethods = {
269 *
270 * @param {Function} cb Returns true if item should be in result.
271 * @param {number} start Start index of filter range.
272 - * @param {number} end End index of map range.
272 + * @param {number} length End index of map range.
273 * @param {*!?} context Context of callback invocation.
274 * @return {OrderedMap} OrderedMap resulting from filtering the range.
275 */
@@ -438,7 +438,6 @@ var OrderedMapMethods = {
438 * because `undefined` is not ever a valid `OrderedMap` key.
439 *
440 * @private
441 - * @param {number} pos Position for which we're querying the name.
441 * @return {string?} Name of the item at position `pos`, or `undefined` if
442 * there is no item at that position.
443 */
src/utils/ReactChildren.js
+3 -3
@@ -47,7 +47,7 @@ function forEachSingleChild(traverseContext, child, name, i) {
47 * leaf child.
48 *
49 * @param {?*} children Children tree container.
50 - * @param {function(*, int)} forEachFunc.
50 + * @param {function(*, int)} forEachFunc
51 * @param {*} forEachContext Context for forEachContext.
52 */
53 function forEachChildren(children, forEachFunc, forEachContext) {
@@ -109,8 +109,8 @@ function mapSingleChildIntoContext(traverseContext, child, name, i) {
109 * previously relying on the fact that we guarded against null children.
110 *
111 * @param {?*} children Children tree container.
112 - * @param {function(*, int)} mapFunction.
113 - * @param {*} mapContext Context for mapFunction.
112 + * @param {function(*, int)} func The map function.
113 + * @param {*} context Context for mapFunction.
114 * @return {object} Object containing the ordered map of results.
115 */
116 function mapChildren(children, func, context) {
src/utils/Transaction.js
+10 -4
@@ -107,13 +107,19 @@ var Mixin = {
107 /**
108 * Executes the function within a safety window. Use this for the top level
109 * methods that result in large amounts of computation/mutations that would
110 - * need to be safety checked.
110 + * need to be safety checked. The optional arguments helps prevent the need
111 + * to bind in many cases.
112 *
113 * @param {function} method Member of scope to call.
114 * @param {Object} scope Scope to invoke from.
114 - * @param {Object?=} args... Arguments to pass to the method (optional).
115 - * Helps prevent need to bind in many cases.
116 - * @return Return value from `method`.
115 + * @param {Object?=} a Argument to pass to the method.
116 + * @param {Object?=} b Argument to pass to the method.
117 + * @param {Object?=} c Argument to pass to the method.
118 + * @param {Object?=} d Argument to pass to the method.
119 + * @param {Object?=} e Argument to pass to the method.
120 + * @param {Object?=} f Argument to pass to the method.
121 + *
122 + * @return {*} Return value from `method`.
123 */
124 perform: function(method, scope, a, b, c, d, e, f) {
125 invariant(
src/utils/forEachAccumulated.js
+1 -1
@@ -12,7 +12,7 @@
12 'use strict';
13
14 /**
15 - * @param {array} an "accumulation" of items which is either an Array or
15 + * @param {array} arr an "accumulation" of items which is either an Array or
16 * a single item. Useful when paired with the `accumulate` module. This is a
17 * simple utility that allows us to reason about a collection of items, but
18 * handling the case when there is exactly one item (and we do not need to
src/utils/joinClasses.js
+1 -1
@@ -16,7 +16,7 @@
16 * Combines multiple className strings into one.
17 * http://jsperf.com/joinclasses-args-vs-array
18 *
19 - * @param {...?string} classes
19 + * @param {...?string} className
20 * @return {string}
21 */
22 function joinClasses(className/*, ... */) {
src/utils/traverseAllChildren.js
+1 -1
@@ -60,7 +60,7 @@ function getComponentKey(component, index) {
60 /**
61 * Escape a component key so that it is safe to use in a reactid.
62 *
63 - * @param {*} key Component key to be escaped.
63 + * @param {*} text Component key to be escaped.
64 * @return {string} An escaped string.
65 */
66 function escapeUserProvidedKey(text) {
vendor/browser-transforms.js
+2 -1
@@ -184,7 +184,8 @@ function run(code, url, options) {
184 * Load script from the provided url and pass the content to the callback.
185 *
186 * @param {string} url The location of the script src
187 - * @param {function} callback Function to call with the content of url
187 + * @param {function} successCallback Function to call with the content of url
188 + * @param {function} errorCallback Function to call if error
189 * @internal
190 */
191 function load(url, successCallback, errorCallback) {
vendor/fbtransform/visitors.js
+1 -1
@@ -96,7 +96,7 @@ function getAllVisitors(excludes) {
96 * Given a list of visitor set names, return the ordered list of visitors to be
97 * passed to jstransform.
98 *
99 - * @param {array}
99 + * @param {array} sets
100 * @return {array}
101 */
102 function getVisitorsBySet(sets) {