Skip to content

Class: PropertyStore

A cache of INDI property vectors plus a subscription registry.

Constructors

Constructor

new PropertyStore(): PropertyStore

Returns

PropertyStore

Methods

apply()

apply(message): PropertyEvent | null

Fold one inbound message into the cache.

Returns the change applied, or null if the message did not change the cache (an unknown set, or a non-property message).

Parameters

message

IndiMessage

Returns

PropertyEvent | null


device()

device(name): DeviceSnapshot

Return a stable read-only snapshot of one device's properties.

The returned object identity only changes when that device changes, so it is safe to use directly as a useSyncExternalStore snapshot.

Parameters

name

string

Returns

DeviceSnapshot


devices()

devices(): readonly string[]

Return a stable, sorted list of all known device names.

Returns

readonly string[]


get()

get(device, name): Vector | undefined

Return a cached vector, or undefined if it is not present.

Parameters

device

string

name

string

Returns

Vector | undefined


matching()

matching(event): Subscriber[]

Return the callbacks whose device/name filters match an event.

Parameters

event

PropertyEvent

Returns

Subscriber[]


subscribe()

subscribe(callback, filter?): () => void

Register a callback for matching property events; returns an unsubscribe fn.

Parameters

callback

Subscriber

filter?

SubscriptionFilter

Returns

() => void