Skip to main content
Version: Next

StorageApi.observe$()

Home > @backstage/core-plugin-api > StorageApi > observe$

Observe the value over time for a particular key in the current bucket.

Signature:

observe$<T extends JsonValue>(key: string): Observable<StorageValueSnapshot<T>>;

Parameters

ParameterTypeDescription
keystringUnique key associated with the data

Returns:

Observable<StorageValueSnapshot<T>>

Remarks

The observable will only emit values when the value changes in the underlying storage, although multiple values with the same shape may be emitted in a row.

If a StorageApi.snapshot() of a key is retrieved and the presence is 'unknown', then you are guaranteed to receive a snapshot with a known presence, as long as you observe the key within the same tick.

Since the emitted values are shared across all subscribers, it is important not to mutate the returned values. The values may be frozen as a precaution.