set Method

Sets a value for the specified key

@param key: string
The key to associate the value with

@param value: T
The value to be set for the key

API

set(key: string, value: T): void;

Example

class ExampleSource<T = any> implements KeyValueSource<T> {
  private data: Index<T> = {};
  private readonly subject = new Subject<string>();
  
  set(key: string, value: T): void {
    this.data[key] = value;
    this.subject.next(key);
  }
  
  // ...
}