GraphReFlyTS

API Reference

metricKey()

Build a stable measurement cache key.

Import

import { metricKey } from "@graphrefly/ts/solutions/reactive-layout";

Signature

function metricKey(
	text: string,
	font: string,
): string

Parameters

ParameterTypeDescription
textstringText input.
fontstringFont string.

Returns

A deterministic cache key for the text/font pair.

Example

metricKey("Hello", "16px sans-serif");

Source

packages/ts/src/solutions/reactive-layout/segment.ts