Skip to main content
cngx-src documentation

injectLatencyProbe

Functioncommon/data/async-registryv0.1.0

projects/common/data/async-registry/inject-latency-probe.ts

Description#

Bridges CngxAsyncRegistry into a CngxLatencyProbe measuring the registry's observed busy-envelope: how long the app was "anything loading" during the last in-flight window.

An app-shell indicator compares lastDuration() against CNGX_LOADING_CONFIG.spinnerVsSkeletonCutoff to pick a spinner (fast last aggregate) vs a skeleton (slow last aggregate) before the next load renders.

When the registry is absent (provideAsyncRegistry never called), injectAsyncRegistry() returns null, so the probe's source is permanently false: it is never busy and never throws.

Must run in an injection context.

Signature#

injectLatencyProbe()

Returns#

CngxLatencyProbe

A probe over CngxAsyncRegistry.isAnythingLoading.