Home / Function/ getTextWidth() — react Function Reference

getTextWidth() — react Function Reference

Architecture documentation for the getTextWidth() function in text.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  0b0e3142_4743_a84d_6f31_7f99707e3dee["getTextWidth()"]
  021281ec_8833_1644_b4c0_b06b07634697["text.js"]
  0b0e3142_4743_a84d_6f31_7f99707e3dee -->|defined in| 021281ec_8833_1644_b4c0_b06b07634697
  f48fe0f6_f3a8_290b_ed64_ae744f1c7286["trimText()"]
  f48fe0f6_f3a8_290b_ed64_ae744f1c7286 -->|calls| 0b0e3142_4743_a84d_6f31_7f99707e3dee
  style 0b0e3142_4743_a84d_6f31_7f99707e3dee fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-devtools-timeline/src/content-views/utils/text.js lines 17–28

export function getTextWidth(
  context: CanvasRenderingContext2D,
  text: string,
): number {
  let measuredWidth = cachedTextWidths.get(text);
  if (measuredWidth == null) {
    measuredWidth = context.measureText(text).width;
    cachedTextWidths.set(text, measuredWidth);
  }

  return ((measuredWidth: any): number);
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does getTextWidth() do?
getTextWidth() is a function in the react codebase, defined in packages/react-devtools-timeline/src/content-views/utils/text.js.
Where is getTextWidth() defined?
getTextWidth() is defined in packages/react-devtools-timeline/src/content-views/utils/text.js at line 17.
What calls getTextWidth()?
getTextWidth() is called by 1 function(s): trimText.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free