( asyncInfo: ReactAsyncInfo, trackIdx: number, startTime: number, endTime: number, rootEnv: string, value: mixed, )
| 467 | } |
| 468 | |
| 469 | export function logComponentAwait( |
| 470 | asyncInfo: ReactAsyncInfo, |
| 471 | trackIdx: number, |
| 472 | startTime: number, |
| 473 | endTime: number, |
| 474 | rootEnv: string, |
| 475 | value: mixed, |
| 476 | ): void { |
| 477 | if (supportsUserTiming && endTime > 0) { |
| 478 | const description = getIODescription(value); |
| 479 | const name = getIOShortName( |
| 480 | asyncInfo.awaited, |
| 481 | description, |
| 482 | asyncInfo.env, |
| 483 | rootEnv, |
| 484 | ); |
| 485 | const entryName = 'await ' + name; |
| 486 | const color = getIOColor(name); |
| 487 | const debugTask = asyncInfo.debugTask || asyncInfo.awaited.debugTask; |
| 488 | if (__DEV__ && debugTask) { |
| 489 | const properties: Array<[string, string]> = []; |
| 490 | if (typeof value === 'object' && value !== null) { |
| 491 | addObjectToProperties(value, properties, 0, ''); |
| 492 | } else if (value !== undefined) { |
| 493 | addValueToProperties('awaited value', value, properties, 0, ''); |
| 494 | } |
| 495 | const tooltipText = getIOLongName( |
| 496 | asyncInfo.awaited, |
| 497 | description, |
| 498 | asyncInfo.env, |
| 499 | rootEnv, |
| 500 | ); |
| 501 | debugTask.run( |
| 502 | // $FlowFixMe[method-unbinding] |
| 503 | performance.measure.bind(performance, entryName, { |
| 504 | start: startTime < 0 ? 0 : startTime, |
| 505 | end: endTime, |
| 506 | detail: { |
| 507 | devtools: { |
| 508 | color: color, |
| 509 | track: trackNames[trackIdx], |
| 510 | trackGroup: COMPONENTS_TRACK, |
| 511 | properties, |
| 512 | tooltipText, |
| 513 | }, |
| 514 | }, |
| 515 | }), |
| 516 | ); |
| 517 | } else { |
| 518 | console.timeStamp( |
| 519 | entryName, |
| 520 | startTime < 0 ? 0 : startTime, |
| 521 | endTime, |
| 522 | trackNames[trackIdx], |
| 523 | COMPONENTS_TRACK, |
| 524 | color, |
| 525 | ); |
| 526 | } |
no test coverage detected