Data SourcesReferenceKeyValueSourcePart

KeyValueSourcePart Class

Implements the DataSource interface and provides functionality for managing a specific portion of a key-value source. It allows observing, retrieving, setting, and removing data associated with a particular key

@template T
The type of data stored in the key-value source

See also: KeyValueSource

API

class KeyValueSourcePart<T> implements DataSource<T> {
  readonly $: Observable<T>;
  constructor(key: string, source: KeyValueSource);
  get(): T;
  set(value: T): void;
  remove(): void;
}

Example

import {KeyValueSourcePart, MemoryStorage} from '@bitfiber/rx';
 
// Creates a memory source part
const source = new KeyValueSourcePart<number>('someKey', new MemoryStorage());