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
draw(context: CanvasRenderingContext2D) { const { frame, _profilerData: {schedulingEvents}, _hoveredEvent, visibleArea, } = this; context.fillStyle = COLORS.BACKGROUND; context.fillRect( visibleArea.origin.x, visibleArea.origin.y, visibleArea.size.width, ...
Draw a single `SchedulingEvent` as a circle in the canvas.
draw
javascript
facebook/react
packages/react-devtools-timeline/src/content-views/SchedulingEventsView.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/content-views/SchedulingEventsView.js
MIT
_drawSingleThrownError( context: CanvasRenderingContext2D, rect: Rect, thrownError: ThrownError, baseY: number, scaleFactor: number, showHoverHighlight: boolean, ) { const {frame} = this; const {timestamp} = thrownError; const x = timestampToPosition(timestamp, scaleFactor, frame)...
Draw a single `ThrownError` as a circle in the canvas.
_drawSingleThrownError
javascript
facebook/react
packages/react-devtools-timeline/src/content-views/ThrownErrorsView.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/content-views/ThrownErrorsView.js
MIT
draw(context: CanvasRenderingContext2D) { const { frame, _profilerData: {thrownErrors}, _hoveredEvent, visibleArea, } = this; context.fillStyle = COLORS.BACKGROUND; context.fillRect( visibleArea.origin.x, visibleArea.origin.y, visibleArea.size.width, visi...
Draw a single `ThrownError` as a circle in the canvas.
draw
javascript
facebook/react
packages/react-devtools-timeline/src/content-views/ThrownErrorsView.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/content-views/ThrownErrorsView.js
MIT
function hslaColorToString({h, s, l, a}: HslaColor): string { return `hsl(${h}deg ${s}% ${l}% / ${a})`; }
Alpha is a percentage, 0% is fully transparent, and 100 is not transparent at all.
hslaColorToString
javascript
facebook/react
packages/react-devtools-timeline/src/content-views/utils/colors.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/content-views/utils/colors.js
MIT
function dimmedColor(color: HslaColor, dimDelta: number): HslaColor { return { ...color, l: color.l - dimDelta, }; }
Alpha is a percentage, 0% is fully transparent, and 100 is not transparent at all.
dimmedColor
javascript
facebook/react
packages/react-devtools-timeline/src/content-views/utils/colors.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/content-views/utils/colors.js
MIT
function indexToValueInSpace(index: number, space: ColorSpace): number { if (typeof space === 'number') { return space; } const count = space.count || space.max - space.min; index %= count; return ( space.min + Math.floor((index / (count - 1)) * (space.max - space.min)) ); }
Alpha is a percentage, 0% is fully transparent, and 100 is not transparent at all.
indexToValueInSpace
javascript
facebook/react
packages/react-devtools-timeline/src/content-views/utils/colors.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/content-views/utils/colors.js
MIT
function assertNoOverlappingComponentMeasure(state: ProcessorState) { if (state.currentReactComponentMeasure !== null) { console.error( 'Component measure started while another measure in progress:', state.currentReactComponentMeasure, ); } }
Intermediate processor state. May be mutated.
assertNoOverlappingComponentMeasure
javascript
facebook/react
packages/react-devtools-timeline/src/import-worker/preprocessData.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/import-worker/preprocessData.js
MIT
function assertCurrentComponentMeasureType( state: ProcessorState, type: ReactComponentMeasureType, ): void { if (state.currentReactComponentMeasure === null) { console.error( `Component measure type "${type}" stopped while no measure was in progress`, ); } else if (state.currentReactComponentMeas...
Intermediate processor state. May be mutated.
assertCurrentComponentMeasureType
javascript
facebook/react
packages/react-devtools-timeline/src/import-worker/preprocessData.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/import-worker/preprocessData.js
MIT
function processReactComponentMeasure( name: string, startTime: Milliseconds, currentProfilerData: TimelineData, state: ProcessorState, ): void { if (name.startsWith('--component-render-start-')) { const [componentName] = name.slice(25).split('-'); assertNoOverlappingComponentMeasure(state); sta...
Intermediate processor state. May be mutated.
processReactComponentMeasure
javascript
facebook/react
packages/react-devtools-timeline/src/import-worker/preprocessData.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/import-worker/preprocessData.js
MIT
function preprocessFlamechart(rawData: TimelineEvent[]): Flamechart { let parsedData; try { parsedData = importFromChromeTimeline(rawData, 'react-devtools'); } catch (error) { // Assume any Speedscope errors are caused by bad profiles const errorToRethrow = new InvalidProfileError(error.message); ...
Intermediate processor state. May be mutated.
preprocessFlamechart
javascript
facebook/react
packages/react-devtools-timeline/src/import-worker/preprocessData.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/import-worker/preprocessData.js
MIT
function parseStackFrame(stackFrame: string): ErrorStackFrame | null { const error = new Error(); error.stack = stackFrame; const frames = ErrorStackParser.parse(error); return frames.length === 1 ? frames[0] : null; }
Intermediate processor state. May be mutated.
parseStackFrame
javascript
facebook/react
packages/react-devtools-timeline/src/import-worker/preprocessData.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/import-worker/preprocessData.js
MIT
async function preprocessData( timeline: TimelineEvent[], ): Promise<TimelineData> { const flamechart = preprocessFlamechart(timeline); const laneToReactMeasureMap: Map<ReactLane, Array<ReactMeasure>> = new Map(); for (let lane: ReactLane = 0; lane < REACT_TOTAL_NUM_LANES; lane++) { laneToReactMeasureMap.s...
Intermediate processor state. May be mutated.
preprocessData
javascript
facebook/react
packages/react-devtools-timeline/src/import-worker/preprocessData.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/import-worker/preprocessData.js
MIT
draw(context: CanvasRenderingContext2D) { const {visibleArea} = this; context.fillStyle = COLORS.BACKGROUND; context.fillRect( visibleArea.origin.x, visibleArea.origin.y, visibleArea.size.width, visibleArea.size.height, ); }
View that fills its visible area with a CSS color.
draw
javascript
facebook/react
packages/react-devtools-timeline/src/view-base/BackgroundColorView.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/view-base/BackgroundColorView.js
MIT
function pointEqualToPoint(point1: Point, point2: Point): boolean { return point1.x === point2.x && point1.y === point2.y; }
Alternative representation of `Rect`. A tuple of (`top`, `right`, `bottom`, `left`) coordinates.
pointEqualToPoint
javascript
facebook/react
packages/react-devtools-timeline/src/view-base/geometry.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/view-base/geometry.js
MIT
function sizeEqualToSize(size1: Size, size2: Size): boolean { return size1.width === size2.width && size1.height === size2.height; }
Alternative representation of `Rect`. A tuple of (`top`, `right`, `bottom`, `left`) coordinates.
sizeEqualToSize
javascript
facebook/react
packages/react-devtools-timeline/src/view-base/geometry.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/view-base/geometry.js
MIT
function rectEqualToRect(rect1: Rect, rect2: Rect): boolean { return ( pointEqualToPoint(rect1.origin, rect2.origin) && sizeEqualToSize(rect1.size, rect2.size) ); }
Alternative representation of `Rect`. A tuple of (`top`, `right`, `bottom`, `left`) coordinates.
rectEqualToRect
javascript
facebook/react
packages/react-devtools-timeline/src/view-base/geometry.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/view-base/geometry.js
MIT
function sizeIsValid({width, height}: Size): boolean { return width >= 0 && height >= 0; }
Alternative representation of `Rect`. A tuple of (`top`, `right`, `bottom`, `left`) coordinates.
sizeIsValid
javascript
facebook/react
packages/react-devtools-timeline/src/view-base/geometry.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/view-base/geometry.js
MIT
function sizeIsEmpty({width, height}: Size): boolean { return width <= 0 || height <= 0; }
Alternative representation of `Rect`. A tuple of (`top`, `right`, `bottom`, `left`) coordinates.
sizeIsEmpty
javascript
facebook/react
packages/react-devtools-timeline/src/view-base/geometry.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/view-base/geometry.js
MIT
function rectToBox(rect: Rect): Box { const top = rect.origin.y; const right = rect.origin.x + rect.size.width; const bottom = rect.origin.y + rect.size.height; const left = rect.origin.x; return [top, right, bottom, left]; }
Alternative representation of `Rect`. A tuple of (`top`, `right`, `bottom`, `left`) coordinates.
rectToBox
javascript
facebook/react
packages/react-devtools-timeline/src/view-base/geometry.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/view-base/geometry.js
MIT
function boxToRect(box: Box): Rect { const [top, right, bottom, left] = box; return { origin: { x: left, y: top, }, size: { width: right - left, height: bottom - top, }, }; }
Alternative representation of `Rect`. A tuple of (`top`, `right`, `bottom`, `left`) coordinates.
boxToRect
javascript
facebook/react
packages/react-devtools-timeline/src/view-base/geometry.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/view-base/geometry.js
MIT
function rectIntersectsRect(rect1: Rect, rect2: Rect): boolean { if ( rect1.size.width === 0 || rect1.size.height === 0 || rect2.size.width === 0 || rect2.size.height === 0 ) { return false; } const [top1, right1, bottom1, left1] = rectToBox(rect1); const [top2, right2, bottom2, left2] = ...
Alternative representation of `Rect`. A tuple of (`top`, `right`, `bottom`, `left`) coordinates.
rectIntersectsRect
javascript
facebook/react
packages/react-devtools-timeline/src/view-base/geometry.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/view-base/geometry.js
MIT
function intersectionOfRects(rect1: Rect, rect2: Rect): Rect { const [top1, right1, bottom1, left1] = rectToBox(rect1); const [top2, right2, bottom2, left2] = rectToBox(rect2); return boxToRect([ Math.max(top1, top2), Math.min(right1, right2), Math.min(bottom1, bottom2), Math.max(left1, left2), ...
Returns the intersection of the 2 rectangles. Prerequisite: `rect1` must intersect with `rect2`.
intersectionOfRects
javascript
facebook/react
packages/react-devtools-timeline/src/view-base/geometry.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/view-base/geometry.js
MIT
function rectContainsPoint({x, y}: Point, rect: Rect): boolean { const [top, right, bottom, left] = rectToBox(rect); return left <= x && x <= right && top <= y && y <= bottom; }
Returns the intersection of the 2 rectangles. Prerequisite: `rect1` must intersect with `rect2`.
rectContainsPoint
javascript
facebook/react
packages/react-devtools-timeline/src/view-base/geometry.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/view-base/geometry.js
MIT
function unionOfRects(...rects: Rect[]): Rect { if (rects.length === 0) { return zeroRect; } const [firstRect, ...remainingRects] = rects; const boxUnion = remainingRects .map(rectToBox) .reduce((intermediateUnion, nextBox): Box => { const [unionTop, unionRight, unionBottom, unionLeft] = inte...
Returns the smallest rectangle that contains all provided rects. @returns Union of `rects`. If `rects` is empty, returns `zeroRect`.
unionOfRects
javascript
facebook/react
packages/react-devtools-timeline/src/view-base/geometry.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/view-base/geometry.js
MIT
setScrollState(proposedState: ScrollState) { const clampedState = clampState({ state: proposedState, minContentLength: this._intrinsicContentWidth * MIN_ZOOM_LEVEL, maxContentLength: this._intrinsicContentWidth * MAX_ZOOM_LEVEL, containerLength: this.frame.size.width, }); if ( ...
Just sets scroll state. Use `_setStateAndInformCallbacksIfChanged` if this view's callbacks should also be called. @returns Whether state was changed @private
setScrollState
javascript
facebook/react
packages/react-devtools-timeline/src/view-base/HorizontalPanAndZoomView.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/view-base/HorizontalPanAndZoomView.js
MIT
zoomToRange(rangeStart: number, rangeEnd: number) { const newState = moveStateToRange({ state: this._viewState.horizontalScrollState, rangeStart, rangeEnd, contentLength: this._intrinsicContentWidth, minContentLength: this._intrinsicContentWidth * MIN_ZOOM_LEVEL, maxContentLengt...
Zoom to a specific range of the content specified as a range of the content view's intrinsic content size. Does not inform callbacks of state change since this is a public API.
zoomToRange
javascript
facebook/react
packages/react-devtools-timeline/src/view-base/HorizontalPanAndZoomView.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/view-base/HorizontalPanAndZoomView.js
MIT
desiredSize(): Size | IntrinsicSize { return this._contentView.desiredSize(); }
Zoom to a specific range of the content specified as a range of the content view's intrinsic content size. Does not inform callbacks of state change since this is a public API.
desiredSize
javascript
facebook/react
packages/react-devtools-timeline/src/view-base/HorizontalPanAndZoomView.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/view-base/HorizontalPanAndZoomView.js
MIT
layoutSubviews() { const {offset, length} = this._viewState.horizontalScrollState; const proposedFrame = { origin: { x: this.frame.origin.x + offset, y: this.frame.origin.y, }, size: { width: length, height: this.frame.size.height, }, }; this._cont...
Zoom to a specific range of the content specified as a range of the content view's intrinsic content size. Does not inform callbacks of state change since this is a public API.
layoutSubviews
javascript
facebook/react
packages/react-devtools-timeline/src/view-base/HorizontalPanAndZoomView.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/view-base/HorizontalPanAndZoomView.js
MIT
handleInteraction(interaction: Interaction, viewRefs: ViewRefs) { switch (interaction.type) { case 'mousedown': this._handleMouseDown(interaction, viewRefs); break; case 'mousemove': this._handleMouseMove(interaction, viewRefs); break; case 'mouseup': this._...
Zoom to a specific range of the content specified as a range of the content view's intrinsic content size. Does not inform callbacks of state change since this is a public API.
handleInteraction
javascript
facebook/react
packages/react-devtools-timeline/src/view-base/HorizontalPanAndZoomView.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/view-base/HorizontalPanAndZoomView.js
MIT
_handleMouseDown(interaction: MouseDownInteraction, viewRefs: ViewRefs) { if (rectContainsPoint(interaction.payload.location, this.frame)) { this._isPanning = true; viewRefs.activeView = this; this.currentCursor = 'grabbing'; } }
Zoom to a specific range of the content specified as a range of the content view's intrinsic content size. Does not inform callbacks of state change since this is a public API.
_handleMouseDown
javascript
facebook/react
packages/react-devtools-timeline/src/view-base/HorizontalPanAndZoomView.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/view-base/HorizontalPanAndZoomView.js
MIT
_handleMouseMove(interaction: MouseMoveInteraction, viewRefs: ViewRefs) { const isHovered = rectContainsPoint( interaction.payload.location, this.frame, ); if (isHovered && viewRefs.hoveredView === null) { viewRefs.hoveredView = this; } if (viewRefs.activeView === this) { th...
Zoom to a specific range of the content specified as a range of the content view's intrinsic content size. Does not inform callbacks of state change since this is a public API.
_handleMouseMove
javascript
facebook/react
packages/react-devtools-timeline/src/view-base/HorizontalPanAndZoomView.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/view-base/HorizontalPanAndZoomView.js
MIT
_handleMouseUp(interaction: MouseUpInteraction, viewRefs: ViewRefs) { if (this._isPanning) { this._isPanning = false; } if (viewRefs.activeView === this) { viewRefs.activeView = null; } }
Zoom to a specific range of the content specified as a range of the content view's intrinsic content size. Does not inform callbacks of state change since this is a public API.
_handleMouseUp
javascript
facebook/react
packages/react-devtools-timeline/src/view-base/HorizontalPanAndZoomView.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/view-base/HorizontalPanAndZoomView.js
MIT
_handleWheel(interaction: WheelPlainInteraction | WheelWithShiftInteraction) { const { location, delta: {deltaX, deltaY}, } = interaction.payload; if (!rectContainsPoint(location, this.frame)) { return; // Not scrolling on view } const absDeltaX = Math.abs(deltaX); const absD...
Zoom to a specific range of the content specified as a range of the content view's intrinsic content size. Does not inform callbacks of state change since this is a public API.
_handleWheel
javascript
facebook/react
packages/react-devtools-timeline/src/view-base/HorizontalPanAndZoomView.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/view-base/HorizontalPanAndZoomView.js
MIT
function viewToLayoutInfo(view: View): LayoutInfo { return {view, frame: view.frame}; }
A function that takes a list of subviews, currently laid out in `existingLayout`, and lays them out into `containingFrame`.
viewToLayoutInfo
javascript
facebook/react
packages/react-devtools-timeline/src/view-base/layouter.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/view-base/layouter.js
MIT
function viewsToLayout(views: View[]): Layout { return views.map(viewToLayoutInfo); }
A function that takes a list of subviews, currently laid out in `existingLayout`, and lays them out into `containingFrame`.
viewsToLayout
javascript
facebook/react
packages/react-devtools-timeline/src/view-base/layouter.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/view-base/layouter.js
MIT
function collapseLayoutIntoViews(layout: Layout) { layout.forEach(({view, frame}) => view.setFrame(frame)); }
Applies `layout`'s `frame`s to its corresponding `view`.
collapseLayoutIntoViews
javascript
facebook/react
packages/react-devtools-timeline/src/view-base/layouter.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/view-base/layouter.js
MIT
layeredLayout: Layouter = (layout, containerFrame) => { return layout.map(layoutInfo => ({...layoutInfo, frame: containerFrame})); }
Layer views on top of each other. All views' frames will be set to `containerFrame`. Equivalent to composing: - `alignToContainerXLayout`, - `alignToContainerYLayout`, - `containerWidthLayout`, and - `containerHeightLayout`.
layeredLayout
javascript
facebook/react
packages/react-devtools-timeline/src/view-base/layouter.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/view-base/layouter.js
MIT
layeredLayout: Layouter = (layout, containerFrame) => { return layout.map(layoutInfo => ({...layoutInfo, frame: containerFrame})); }
Layer views on top of each other. All views' frames will be set to `containerFrame`. Equivalent to composing: - `alignToContainerXLayout`, - `alignToContainerYLayout`, - `containerWidthLayout`, and - `containerHeightLayout`.
layeredLayout
javascript
facebook/react
packages/react-devtools-timeline/src/view-base/layouter.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/view-base/layouter.js
MIT
verticallyStackedLayout: Layouter = (layout, containerFrame) => { let currentY = containerFrame.origin.y; return layout.map(layoutInfo => { const desiredSize = layoutInfo.view.desiredSize(); const height = desiredSize ? desiredSize.height : containerFrame.origin.y + containerFrame.size.height - ...
Stacks `views` vertically in `frame`. All views in `views` will have their widths set to the frame's width.
verticallyStackedLayout
javascript
facebook/react
packages/react-devtools-timeline/src/view-base/layouter.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/view-base/layouter.js
MIT
verticallyStackedLayout: Layouter = (layout, containerFrame) => { let currentY = containerFrame.origin.y; return layout.map(layoutInfo => { const desiredSize = layoutInfo.view.desiredSize(); const height = desiredSize ? desiredSize.height : containerFrame.origin.y + containerFrame.size.height - ...
Stacks `views` vertically in `frame`. All views in `views` will have their widths set to the frame's width.
verticallyStackedLayout
javascript
facebook/react
packages/react-devtools-timeline/src/view-base/layouter.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/view-base/layouter.js
MIT
alignToContainerXLayout: Layouter = (layout, containerFrame) => { return layout.map(layoutInfo => ({ ...layoutInfo, frame: { origin: { x: containerFrame.origin.x, y: layoutInfo.frame.origin.y, }, size: layoutInfo.frame.size, }, })); }
A layouter that aligns all frames' lefts to the container frame's left.
alignToContainerXLayout
javascript
facebook/react
packages/react-devtools-timeline/src/view-base/layouter.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/view-base/layouter.js
MIT
alignToContainerXLayout: Layouter = (layout, containerFrame) => { return layout.map(layoutInfo => ({ ...layoutInfo, frame: { origin: { x: containerFrame.origin.x, y: layoutInfo.frame.origin.y, }, size: layoutInfo.frame.size, }, })); }
A layouter that aligns all frames' lefts to the container frame's left.
alignToContainerXLayout
javascript
facebook/react
packages/react-devtools-timeline/src/view-base/layouter.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/view-base/layouter.js
MIT
alignToContainerYLayout: Layouter = (layout, containerFrame) => { return layout.map(layoutInfo => ({ ...layoutInfo, frame: { origin: { x: layoutInfo.frame.origin.x, y: containerFrame.origin.y, }, size: layoutInfo.frame.size, }, })); }
A layouter that aligns all frames' tops to the container frame's top.
alignToContainerYLayout
javascript
facebook/react
packages/react-devtools-timeline/src/view-base/layouter.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/view-base/layouter.js
MIT
alignToContainerYLayout: Layouter = (layout, containerFrame) => { return layout.map(layoutInfo => ({ ...layoutInfo, frame: { origin: { x: layoutInfo.frame.origin.x, y: containerFrame.origin.y, }, size: layoutInfo.frame.size, }, })); }
A layouter that aligns all frames' tops to the container frame's top.
alignToContainerYLayout
javascript
facebook/react
packages/react-devtools-timeline/src/view-base/layouter.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/view-base/layouter.js
MIT
containerWidthLayout: Layouter = (layout, containerFrame) => { return layout.map(layoutInfo => ({ ...layoutInfo, frame: { origin: layoutInfo.frame.origin, size: { width: containerFrame.size.width, height: layoutInfo.frame.size.height, }, }, })); }
A layouter that sets all frames' widths to `containerFrame.size.width`.
containerWidthLayout
javascript
facebook/react
packages/react-devtools-timeline/src/view-base/layouter.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/view-base/layouter.js
MIT
containerWidthLayout: Layouter = (layout, containerFrame) => { return layout.map(layoutInfo => ({ ...layoutInfo, frame: { origin: layoutInfo.frame.origin, size: { width: containerFrame.size.width, height: layoutInfo.frame.size.height, }, }, })); }
A layouter that sets all frames' widths to `containerFrame.size.width`.
containerWidthLayout
javascript
facebook/react
packages/react-devtools-timeline/src/view-base/layouter.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/view-base/layouter.js
MIT
containerHeightLayout: Layouter = (layout, containerFrame) => { return layout.map(layoutInfo => ({ ...layoutInfo, frame: { origin: layoutInfo.frame.origin, size: { width: layoutInfo.frame.size.width, height: containerFrame.size.height, }, }, })); }
A layouter that sets all frames' heights to `containerFrame.size.height`.
containerHeightLayout
javascript
facebook/react
packages/react-devtools-timeline/src/view-base/layouter.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/view-base/layouter.js
MIT
containerHeightLayout: Layouter = (layout, containerFrame) => { return layout.map(layoutInfo => ({ ...layoutInfo, frame: { origin: layoutInfo.frame.origin, size: { width: layoutInfo.frame.size.width, height: containerFrame.size.height, }, }, })); }
A layouter that sets all frames' heights to `containerFrame.size.height`.
containerHeightLayout
javascript
facebook/react
packages/react-devtools-timeline/src/view-base/layouter.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/view-base/layouter.js
MIT
desiredHeightLayout: Layouter = layout => { return layout.map(layoutInfo => { const desiredSize = layoutInfo.view.desiredSize(); const height = desiredSize ? desiredSize.height : 0; return { ...layoutInfo, frame: { origin: layoutInfo.frame.origin, size: { width: layou...
A layouter that sets all frames' heights to the desired height of its view. If the view has no desired size, the frame's height is set to 0.
desiredHeightLayout
javascript
facebook/react
packages/react-devtools-timeline/src/view-base/layouter.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/view-base/layouter.js
MIT
desiredHeightLayout: Layouter = layout => { return layout.map(layoutInfo => { const desiredSize = layoutInfo.view.desiredSize(); const height = desiredSize ? desiredSize.height : 0; return { ...layoutInfo, frame: { origin: layoutInfo.frame.origin, size: { width: layou...
A layouter that sets all frames' heights to the desired height of its view. If the view has no desired size, the frame's height is set to 0.
desiredHeightLayout
javascript
facebook/react
packages/react-devtools-timeline/src/view-base/layouter.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/view-base/layouter.js
MIT
uniformMaxSubviewHeightLayout: Layouter = layout => { const maxHeight = Math.max( ...layout.map(layoutInfo => layoutInfo.frame.size.height), ); return layout.map(layoutInfo => ({ ...layoutInfo, frame: { origin: layoutInfo.frame.origin, size: { width: layoutInfo.frame.size.width, ...
A layouter that sets all frames' heights to the height of the tallest frame.
uniformMaxSubviewHeightLayout
javascript
facebook/react
packages/react-devtools-timeline/src/view-base/layouter.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/view-base/layouter.js
MIT
uniformMaxSubviewHeightLayout: Layouter = layout => { const maxHeight = Math.max( ...layout.map(layoutInfo => layoutInfo.frame.size.height), ); return layout.map(layoutInfo => ({ ...layoutInfo, frame: { origin: layoutInfo.frame.origin, size: { width: layoutInfo.frame.size.width, ...
A layouter that sets all frames' heights to the height of the tallest frame.
uniformMaxSubviewHeightLayout
javascript
facebook/react
packages/react-devtools-timeline/src/view-base/layouter.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/view-base/layouter.js
MIT
atLeastContainerHeightLayout: Layouter = ( layout, containerFrame, ) => { return layout.map(layoutInfo => ({ ...layoutInfo, frame: { origin: layoutInfo.frame.origin, size: { width: layoutInfo.frame.size.width, height: Math.max( containerFrame.size.height, la...
A layouter that sets heights in this fashion: - If a frame's height >= `containerFrame.size.height`, the frame is left unchanged. - Otherwise, sets the frame's height to `containerFrame.size.height`.
atLeastContainerHeightLayout
javascript
facebook/react
packages/react-devtools-timeline/src/view-base/layouter.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/view-base/layouter.js
MIT
atLeastContainerHeightLayout: Layouter = ( layout, containerFrame, ) => { return layout.map(layoutInfo => ({ ...layoutInfo, frame: { origin: layoutInfo.frame.origin, size: { width: layoutInfo.frame.size.width, height: Math.max( containerFrame.size.height, la...
A layouter that sets heights in this fashion: - If a frame's height >= `containerFrame.size.height`, the frame is left unchanged. - Otherwise, sets the frame's height to `containerFrame.size.height`.
atLeastContainerHeightLayout
javascript
facebook/react
packages/react-devtools-timeline/src/view-base/layouter.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/view-base/layouter.js
MIT
function createComposedLayout(...layouters: Layouter[]): Layouter { if (layouters.length === 0) { return noopLayout; } const composedLayout: Layouter = (layout, containerFrame) => { return layouters.reduce( (intermediateLayout, layouter) => layouter(intermediateLayout, containerFrame), ...
Create a layouter that applies each layouter in `layouters` in sequence.
createComposedLayout
javascript
facebook/react
packages/react-devtools-timeline/src/view-base/layouter.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/view-base/layouter.js
MIT
composedLayout: Layouter = (layout, containerFrame) => { return layouters.reduce( (intermediateLayout, layouter) => layouter(intermediateLayout, containerFrame), layout, ); }
Create a layouter that applies each layouter in `layouters` in sequence.
composedLayout
javascript
facebook/react
packages/react-devtools-timeline/src/view-base/layouter.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/view-base/layouter.js
MIT
composedLayout: Layouter = (layout, containerFrame) => { return layouters.reduce( (intermediateLayout, layouter) => layouter(intermediateLayout, containerFrame), layout, ); }
Create a layouter that applies each layouter in `layouters` in sequence.
composedLayout
javascript
facebook/react
packages/react-devtools-timeline/src/view-base/layouter.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/view-base/layouter.js
MIT
constructor(resetHoveredEvent: ResetHoveredEventFn) { this._resetHoveredEvent = resetHoveredEvent; }
Represents the canvas surface and a view heirarchy. A surface is also the place where all interactions enter the view heirarchy.
constructor
javascript
facebook/react
packages/react-devtools-timeline/src/view-base/Surface.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/view-base/Surface.js
MIT
hasActiveView(): boolean { return this._viewRefs.activeView !== null; }
Represents the canvas surface and a view heirarchy. A surface is also the place where all interactions enter the view heirarchy.
hasActiveView
javascript
facebook/react
packages/react-devtools-timeline/src/view-base/Surface.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/view-base/Surface.js
MIT
setCanvas(canvas: HTMLCanvasElement, canvasSize: Size) { this._context = getCanvasContext( canvas, canvasSize.height, canvasSize.width, ); this._canvasSize = canvasSize; if (this.rootView) { this.rootView.setNeedsDisplay(); } }
Represents the canvas surface and a view heirarchy. A surface is also the place where all interactions enter the view heirarchy.
setCanvas
javascript
facebook/react
packages/react-devtools-timeline/src/view-base/Surface.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/view-base/Surface.js
MIT
displayIfNeeded() { const {rootView, _canvasSize, _context} = this; if (!rootView || !_context || !_canvasSize) { return; } rootView.setFrame({ origin: zeroPoint, size: _canvasSize, }); rootView.setVisibleArea({ origin: zeroPoint, size: _canvasSize, }); root...
Represents the canvas surface and a view heirarchy. A surface is also the place where all interactions enter the view heirarchy.
displayIfNeeded
javascript
facebook/react
packages/react-devtools-timeline/src/view-base/Surface.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/view-base/Surface.js
MIT
getCurrentCursor(): string | null { const {activeView, hoveredView} = this._viewRefs; if (activeView !== null) { return activeView.currentCursor; } else if (hoveredView !== null) { return hoveredView.currentCursor; } else { return null; } }
Represents the canvas surface and a view heirarchy. A surface is also the place where all interactions enter the view heirarchy.
getCurrentCursor
javascript
facebook/react
packages/react-devtools-timeline/src/view-base/Surface.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/view-base/Surface.js
MIT
handleInteraction(interaction: Interaction) { const rootView = this.rootView; if (rootView != null) { const viewRefs = this._viewRefs; switch (interaction.type) { case 'mousemove': case 'wheel-control': case 'wheel-meta': case 'wheel-plain': case 'wheel-shift'...
Represents the canvas surface and a view heirarchy. A surface is also the place where all interactions enter the view heirarchy.
handleInteraction
javascript
facebook/react
packages/react-devtools-timeline/src/view-base/Surface.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/view-base/Surface.js
MIT
function clampOffset(state: ScrollState, containerLength: number): ScrollState { return { offset: clamp(-(state.length - containerLength), 0, state.offset), length: state.length, }; }
Single-axis offset and length state. ``` contentStart containerStart containerEnd contentEnd |<----------offset| | | |<-------------------length------------------->| ```
clampOffset
javascript
facebook/react
packages/react-devtools-timeline/src/view-base/utils/scrollState.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/view-base/utils/scrollState.js
MIT
function clampLength({ state, minContentLength, maxContentLength, containerLength, }: { state: ScrollState, minContentLength: number, maxContentLength: number, containerLength: number, }): ScrollState { return { offset: state.offset, length: clamp( Math.max(minContentLength, containerLen...
Single-axis offset and length state. ``` contentStart containerStart containerEnd contentEnd |<----------offset| | | |<-------------------length------------------->| ```
clampLength
javascript
facebook/react
packages/react-devtools-timeline/src/view-base/utils/scrollState.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/view-base/utils/scrollState.js
MIT
function clampState({ state, minContentLength, maxContentLength, containerLength, }: { state: ScrollState, minContentLength: number, maxContentLength: number, containerLength: number, }): ScrollState { return clampOffset( clampLength({ state, minContentLength, maxContentLength, ...
Returns `state` clamped such that: - `length`: you won't be able to zoom in/out such that the content is shorter than the `containerLength`. - `offset`: content remains in `containerLength`.
clampState
javascript
facebook/react
packages/react-devtools-timeline/src/view-base/utils/scrollState.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/view-base/utils/scrollState.js
MIT
function translateState({ state, delta, containerLength, }: { state: ScrollState, delta: number, containerLength: number, }): ScrollState { return clampOffset( { offset: state.offset + delta, length: state.length, }, containerLength, ); }
Returns `state` clamped such that: - `length`: you won't be able to zoom in/out such that the content is shorter than the `containerLength`. - `offset`: content remains in `containerLength`.
translateState
javascript
facebook/react
packages/react-devtools-timeline/src/view-base/utils/scrollState.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/view-base/utils/scrollState.js
MIT
function zoomState({ state, multiplier, fixedPoint, minContentLength, maxContentLength, containerLength, }: { state: ScrollState, multiplier: number, fixedPoint: number, minContentLength: number, maxContentLength: number, containerLength: number, }): ScrollState { // Length and offset must b...
Returns a new clamped `state` zoomed by `multiplier`. The provided fixed point will also remain stationary relative to `containerStart`. ``` contentStart containerStart fixedPoint containerEnd |<---------offset-| x | |-fixedPoint-----------------------------...
zoomState
javascript
facebook/react
packages/react-devtools-timeline/src/view-base/utils/scrollState.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/view-base/utils/scrollState.js
MIT
function moveStateToRange({ state, rangeStart, rangeEnd, contentLength, minContentLength, maxContentLength, containerLength, }: { state: ScrollState, rangeStart: number, rangeEnd: number, contentLength: number, minContentLength: number, maxContentLength: number, containerLength: number, })...
Returns a new clamped `state` zoomed by `multiplier`. The provided fixed point will also remain stationary relative to `containerStart`. ``` contentStart containerStart fixedPoint containerEnd |<---------offset-| x | |-fixedPoint-----------------------------...
moveStateToRange
javascript
facebook/react
packages/react-devtools-timeline/src/view-base/utils/scrollState.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/view-base/utils/scrollState.js
MIT
function areScrollStatesEqual( state1: ScrollState, state2: ScrollState, ): boolean { return state1.offset === state2.offset && state1.length === state2.length; }
Returns a new clamped `state` zoomed by `multiplier`. The provided fixed point will also remain stationary relative to `containerStart`. ``` contentStart containerStart fixedPoint containerEnd |<---------offset-| x | |-fixedPoint-----------------------------...
areScrollStatesEqual
javascript
facebook/react
packages/react-devtools-timeline/src/view-base/utils/scrollState.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/view-base/utils/scrollState.js
MIT
withVerticalScrollbarLayout: Layouter = ( layout, containerFrame, ) => { const [contentLayoutInfo, scrollbarLayoutInfo] = layout; const desiredContentSize = contentLayoutInfo.view.desiredSize(); const shouldShowScrollbar = desiredContentSize.height > containerFrame.size.height; const scrollbarWidth = s...
Assumes {@param layout} will only contain 2 views.
withVerticalScrollbarLayout
javascript
facebook/react
packages/react-devtools-timeline/src/view-base/vertical-scroll-overflow/withVerticalScrollbarLayout.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/view-base/vertical-scroll-overflow/withVerticalScrollbarLayout.js
MIT
withVerticalScrollbarLayout: Layouter = ( layout, containerFrame, ) => { const [contentLayoutInfo, scrollbarLayoutInfo] = layout; const desiredContentSize = contentLayoutInfo.view.desiredSize(); const shouldShowScrollbar = desiredContentSize.height > containerFrame.size.height; const scrollbarWidth = s...
Assumes {@param layout} will only contain 2 views.
withVerticalScrollbarLayout
javascript
facebook/react
packages/react-devtools-timeline/src/view-base/vertical-scroll-overflow/withVerticalScrollbarLayout.js
https://github.com/facebook/react/blob/master/packages/react-devtools-timeline/src/view-base/vertical-scroll-overflow/withVerticalScrollbarLayout.js
MIT
handleChildClick = async function (event) { await deleteAllListeners(PARENT); }
The entire event registration state of the world should be "locked-in" at the time the event occurs. This is to resolve many edge cases that come about from a listener on a lower-in-DOM node causing structural changes at places higher in the DOM. If this lower-in-DOM node causes new content to be rendered at a place hi...
handleChildClick
javascript
facebook/react
packages/react-dom/src/__tests__/ReactBrowserEventEmitter-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactBrowserEventEmitter-test.js
MIT
handleChildClick = async function (event) { await deleteAllListeners(PARENT); }
The entire event registration state of the world should be "locked-in" at the time the event occurs. This is to resolve many edge cases that come about from a listener on a lower-in-DOM node causing structural changes at places higher in the DOM. If this lower-in-DOM node causes new content to be rendered at a place hi...
handleChildClick
javascript
facebook/react
packages/react-dom/src/__tests__/ReactBrowserEventEmitter-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactBrowserEventEmitter-test.js
MIT
handleChildClick = async function (event) { await putListener(PARENT, ON_CLICK_KEY, handleParentClick); }
The entire event registration state of the world should be "locked-in" at the time the event occurs. This is to resolve many edge cases that come about from a listener on a lower-in-DOM node causing structural changes at places higher in the DOM. If this lower-in-DOM node causes new content to be rendered at a place hi...
handleChildClick
javascript
facebook/react
packages/react-dom/src/__tests__/ReactBrowserEventEmitter-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactBrowserEventEmitter-test.js
MIT
handleChildClick = async function (event) { await putListener(PARENT, ON_CLICK_KEY, handleParentClick); }
The entire event registration state of the world should be "locked-in" at the time the event occurs. This is to resolve many edge cases that come about from a listener on a lower-in-DOM node causing structural changes at places higher in the DOM. If this lower-in-DOM node causes new content to be rendered at a place hi...
handleChildClick
javascript
facebook/react
packages/react-dom/src/__tests__/ReactBrowserEventEmitter-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactBrowserEventEmitter-test.js
MIT
render() { return <div />; }
TODO: We should make any setState calls fail in `getInitialState` and `componentWillMount`. They will usually fail anyways because `this._renderedComponent` is empty, however, if a component is *reused*, then that won't be the case and things will appear to work in some cases. Better to just block all updates in initia...
render
javascript
facebook/react
packages/react-dom/src/__tests__/ReactComponentLifeCycle-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactComponentLifeCycle-test.js
MIT
render() { return <div />; }
If a state update triggers rerendering that in turn fires an onDOMReady, that second onDOMReady should not fail.
render
javascript
facebook/react
packages/react-dom/src/__tests__/ReactComponentLifeCycle-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactComponentLifeCycle-test.js
MIT
constructor(props) { super(props); _testJournal.push('SwitcherParent:getInitialState'); this.state = {showHasOnDOMReadyComponent: false}; }
If a state update triggers rerendering that in turn fires an onDOMReady, that second onDOMReady should not fail.
constructor
javascript
facebook/react
packages/react-dom/src/__tests__/ReactComponentLifeCycle-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactComponentLifeCycle-test.js
MIT
componentDidMount() { _testJournal.push('SwitcherParent:onDOMReady'); this.switchIt(); }
If a state update triggers rerendering that in turn fires an onDOMReady, that second onDOMReady should not fail.
componentDidMount
javascript
facebook/react
packages/react-dom/src/__tests__/ReactComponentLifeCycle-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactComponentLifeCycle-test.js
MIT
render() { return ( <div> {this.state.showHasOnDOMReadyComponent ? <Child /> : <div />} </div> ); }
If a state update triggers rerendering that in turn fires an onDOMReady, that second onDOMReady should not fail.
render
javascript
facebook/react
packages/react-dom/src/__tests__/ReactComponentLifeCycle-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactComponentLifeCycle-test.js
MIT
UNSAFE_componentWillMount() { void this.state.yada; }
If a state update triggers rerendering that in turn fires an onDOMReady, that second onDOMReady should not fail.
UNSAFE_componentWillMount
javascript
facebook/react
packages/react-dom/src/__tests__/ReactComponentLifeCycle-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactComponentLifeCycle-test.js
MIT
render() { return <div />; }
If a state update triggers rerendering that in turn fires an onDOMReady, that second onDOMReady should not fail.
render
javascript
facebook/react
packages/react-dom/src/__tests__/ReactComponentLifeCycle-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactComponentLifeCycle-test.js
MIT
UNSAFE_componentWillMount() { this.setState({stateField: 'something'}); }
If a state update triggers rerendering that in turn fires an onDOMReady, that second onDOMReady should not fail.
UNSAFE_componentWillMount
javascript
facebook/react
packages/react-dom/src/__tests__/ReactComponentLifeCycle-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactComponentLifeCycle-test.js
MIT
render() { return <div />; }
If a state update triggers rerendering that in turn fires an onDOMReady, that second onDOMReady should not fail.
render
javascript
facebook/react
packages/react-dom/src/__tests__/ReactComponentLifeCycle-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactComponentLifeCycle-test.js
MIT
constructor(props, context) { super(props, context); this.state = props; }
If a state update triggers rerendering that in turn fires an onDOMReady, that second onDOMReady should not fail.
constructor
javascript
facebook/react
packages/react-dom/src/__tests__/ReactComponentLifeCycle-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactComponentLifeCycle-test.js
MIT
render() { return <div />; }
If a state update triggers rerendering that in turn fires an onDOMReady, that second onDOMReady should not fail.
render
javascript
facebook/react
packages/react-dom/src/__tests__/ReactComponentLifeCycle-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactComponentLifeCycle-test.js
MIT
constructor(props, context) { super(props, context); this.setState({stateField: 'something'}); this.state = {stateField: 'somethingelse'}; }
If a state update triggers rerendering that in turn fires an onDOMReady, that second onDOMReady should not fail.
constructor
javascript
facebook/react
packages/react-dom/src/__tests__/ReactComponentLifeCycle-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactComponentLifeCycle-test.js
MIT
render() { return <div />; }
If a state update triggers rerendering that in turn fires an onDOMReady, that second onDOMReady should not fail.
render
javascript
facebook/react
packages/react-dom/src/__tests__/ReactComponentLifeCycle-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactComponentLifeCycle-test.js
MIT
constructor(props, context) { super(props, context); this._testJournal = {}; const initState = { hasWillMountCompleted: false, hasDidMountCompleted: false, hasRenderCompleted: false, hasWillUnmountCompleted: false, }; this._testJournal.retu...
If a state update triggers rerendering that in turn fires an onDOMReady, that second onDOMReady should not fail.
constructor
javascript
facebook/react
packages/react-dom/src/__tests__/ReactComponentLifeCycle-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactComponentLifeCycle-test.js
MIT
UNSAFE_componentWillMount() { this._testJournal.stateAtStartOfWillMount = clone(this.state); this.state.hasWillMountCompleted = true; }
If a state update triggers rerendering that in turn fires an onDOMReady, that second onDOMReady should not fail.
UNSAFE_componentWillMount
javascript
facebook/react
packages/react-dom/src/__tests__/ReactComponentLifeCycle-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactComponentLifeCycle-test.js
MIT
componentDidMount() { this._testJournal.stateAtStartOfDidMount = clone(this.state); this.setState({hasDidMountCompleted: true}); }
If a state update triggers rerendering that in turn fires an onDOMReady, that second onDOMReady should not fail.
componentDidMount
javascript
facebook/react
packages/react-dom/src/__tests__/ReactComponentLifeCycle-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactComponentLifeCycle-test.js
MIT
render() { const isInitialRender = !this.state.hasRenderCompleted; if (isInitialRender) { this._testJournal.stateInInitialRender = clone(this.state); } else { this._testJournal.stateInLaterRender = clone(this.state); } // you would *NEVER* do anything like thi...
If a state update triggers rerendering that in turn fires an onDOMReady, that second onDOMReady should not fail.
render
javascript
facebook/react
packages/react-dom/src/__tests__/ReactComponentLifeCycle-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactComponentLifeCycle-test.js
MIT
componentWillUnmount() { this._testJournal.stateAtStartOfWillUnmount = clone(this.state); this.state.hasWillUnmountCompleted = true; }
If a state update triggers rerendering that in turn fires an onDOMReady, that second onDOMReady should not fail.
componentWillUnmount
javascript
facebook/react
packages/react-dom/src/__tests__/ReactComponentLifeCycle-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactComponentLifeCycle-test.js
MIT
render() { return <div>{this.props.children}</div>; }
If a state update triggers rerendering that in turn fires an onDOMReady, that second onDOMReady should not fail.
render
javascript
facebook/react
packages/react-dom/src/__tests__/ReactComponentLifeCycle-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactComponentLifeCycle-test.js
MIT
componentDidMount() { const container = document.createElement('div'); this.root = ReactDOMClient.createRoot(container); this.updateTooltip(); }
If a state update triggers rerendering that in turn fires an onDOMReady, that second onDOMReady should not fail.
componentDidMount
javascript
facebook/react
packages/react-dom/src/__tests__/ReactComponentLifeCycle-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactComponentLifeCycle-test.js
MIT
render() { return ( <Tooltip ref={React.createRef()} tooltip={<div>{this.props.tooltipText}</div>}> {this.props.text} </Tooltip> ); }
If a state update triggers rerendering that in turn fires an onDOMReady, that second onDOMReady should not fail.
render
javascript
facebook/react
packages/react-dom/src/__tests__/ReactComponentLifeCycle-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactComponentLifeCycle-test.js
MIT
function shallowEqual(objA: mixed, objB: mixed): boolean { if (Object.is(objA, objB)) { return true; } if ( typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null ) { return false; } const keysA = Object.keys(objA); const ke...
Performs equality by iterating through keys on an object and returning false when any key has values which are not strictly equal between the arguments. Returns true when the values of all keys are strictly equal.
shallowEqual
javascript
facebook/react
packages/react-dom/src/__tests__/ReactCompositeComponent-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactCompositeComponent-test.js
MIT
function shallowCompare(instance, nextProps, nextState) { return ( !shallowEqual(instance.props, nextProps) || !shallowEqual(instance.state, nextState) ); }
Performs equality by iterating through keys on an object and returning false when any key has values which are not strictly equal between the arguments. Returns true when the values of all keys are strictly equal.
shallowCompare
javascript
facebook/react
packages/react-dom/src/__tests__/ReactCompositeComponent-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactCompositeComponent-test.js
MIT
componentDidMount() { instance = this; }
Performs equality by iterating through keys on an object and returning false when any key has values which are not strictly equal between the arguments. Returns true when the values of all keys are strictly equal.
componentDidMount
javascript
facebook/react
packages/react-dom/src/__tests__/ReactCompositeComponent-test.js
https://github.com/facebook/react/blob/master/packages/react-dom/src/__tests__/ReactCompositeComponent-test.js
MIT