Options
All
  • Public
  • Public/Protected
  • All
Menu

PartialObject is an Observable of an object which can be filled out with values one by one, emitting as each property changes. This is particularly useful for assembling a configuration object from multiple (asynchronous) sources.

Type parameters

  • T

Hierarchy

  • Observable<Partial<T>>
    • PartialObject

Index

Constructors

Methods

Constructors

constructor

  • Type parameters

    • T

    Returns PartialObject<T>

Methods

bind

  • bind<U>(k: U, v: undefined | Observable<undefined | null | T[U]>): PartialObject<T>
  • Binds one property of the object to an Observable delivering the appropriate type, making the PartialObject update and emit each time a new value arrives on the bound Observable.

    Note: In many cases (especially when using data from a terminating Observable, such as a HTTP call), it is probably more readable to simply subscribe to the Observable and set the received value using set or setAll. The advantage of using this .bind method is that it keeps the bound observable "cold", and only subscribes to it if there are subscribers to the PartialObject itself.

    Type parameters

    • U: string | number | symbol

    Parameters

    • k: U

      The name of a key in the PartialObject (based on its generic type).

    • v: undefined | Observable<undefined | null | T[U]>

      An Observable of the appropriate type (or null/undefined).

    Returns PartialObject<T>

set

  • Sets the given property in the PartialObject and emits of there are any changes.

    Type parameters

    • U: string | number | symbol

    Parameters

    • k: U
    • v: undefined | null | T[U]

    Returns PartialObject<T>

setAll

  • Sets all the given properties in the PartialObject and emits of there are any changes.

    Parameters

    • o: Partial<T>

    Returns PartialObject<T>