set Method

Sets a new value for the data source. This method updates the value in the data source and notifies observers of the change

@param value: T
The new value to be set for the data source

API

set(value: T): void;

Example

class ExampleSource<T = any> implements DataSource<T> {
  private value: T;
  private readonly subject = new Subject<T>();
  
  set(value: T): void {
    this.value = value;
    this.subject.next(this.value);
  }
  
  // ...
}