Backstage
    Preparing search index...

    Provides a key-value persistence API.

    interface StorageApi {
        forBucket(name: string): StorageApi;
        observe$<T extends JsonValue>(
            key: string,
        ): Observable<StorageValueSnapshot<T>>;
        remove(key: string): Promise<void>;
        set<T extends JsonValue>(key: string, data: T): Promise<void>;
        snapshot<T extends JsonValue>(key: string): StorageValueSnapshot<T>;
    }
    Index

    Methods

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

      Type Parameters

      Parameters

      • key: string

        Unique key associated with the data

      Returns Observable<StorageValueSnapshot<T>>

      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.