Skip to main content
cngx-src documentation

KeyedRegistry

Interface

projects/core/utils/registry.ts

Import#

import { KeyedRegistry } from '@cngx/core/utils'

Description#

Keyed registry handle returned by createKeyedRegistry.

Index#

Instance Properties#

entries#Signal>
Readonly

Registered entries by key, in registration order.

values#Signal
Readonly

Registered values in registration order.

Methods#

get#T | null
get(key: string)

Current holder of key, or null. Reactive (reads entries).

@paramkeystring
register#void
register(key: string, value: T)

Registers value under key. Idempotent for the same (key, value) pair. Registering a DIFFERENT value under an existing key is swap-is-noop: the first registration stays live and dev mode warns - unregister the current holder first for a true swap.

@paramkeystring
@paramvalueT
unregister#void
unregister(key: string, value: T)

Removes the registration for key - but only while value is still the registered holder. A stale holder unregistering after a successor has claimed the key leaves the successor untouched.

@paramkeystring
@paramvalueT