forked from facebook/react
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathReactFiberTracingMarkerComponent.old.js
73 lines (63 loc) · 1.95 KB
/
ReactFiberTracingMarkerComponent.old.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
import type {TransitionTracingCallbacks, Fiber} from './ReactInternalTypes';
import type {OffscreenInstance} from './ReactFiberOffscreenComponent';
import {enableTransitionTracing} from 'shared/ReactFeatureFlags';
export type SuspenseInfo = {name: string | null};
export type TransitionObject = {
transitionName: string,
startTime: number,
};
export type PendingTransitionCallbacks = {
transitionStart: Array<TransitionObject> | null,
transitionComplete: Array<TransitionObject> | null,
};
export type Transition = {
name: string,
startTime: number,
};
export type BatchConfigTransition = {
name?: string,
startTime?: number,
_updatedFibers?: Set<Fiber>,
};
export type PendingSuspenseBoundaries = Map<OffscreenInstance, SuspenseInfo>;
export function processTransitionCallbacks(
pendingTransitions: PendingTransitionCallbacks,
endTime: number,
callbacks: TransitionTracingCallbacks,
): void {
if (enableTransitionTracing) {
if (pendingTransitions !== null) {
const transitionStart = pendingTransitions.transitionStart;
if (transitionStart !== null) {
transitionStart.forEach(transition => {
if (callbacks.onTransitionStart != null) {
callbacks.onTransitionStart(
transition.transitionName,
transition.startTime,
);
}
});
}
const transitionComplete = pendingTransitions.transitionComplete;
if (transitionComplete !== null) {
transitionComplete.forEach(transition => {
if (callbacks.onTransitionComplete != null) {
callbacks.onTransitionComplete(
transition.transitionName,
transition.startTime,
endTime,
);
}
});
}
}
}
}