Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ObservableMap<K, V, S>

Implementation of BaseMap that uses standard Subject based Observables

Type parameters

Hierarchy

Index

Constructors

constructor

Properties

Protected _map

_map: Map<K, SubjectType<S, V>> = new Map()

Native JavaScript map that holds the key-values

size

size: number = this._map.size

Size of the map

Methods

Protected _getOrInit$

clear

  • clear(): void

delete

  • delete(key: K): boolean
  • Will call .complete() on key's subject and remove the key from the map.

    Parameters

    • key: K

      key to remove

    Returns boolean

emitError

  • emitError(key: K, error: any): this
  • Emit an error on the key's observable. This will call .error(error) which ends the observable stream.

    It then removes the key-value from the map since the observable has ended.

    Parameters

    • key: K

      key to emit error on

    • error: any

      error to emit

    Returns this

entries$

  • entries$(): IterableIterator<[K, Observable<V>]>

forEach$

  • forEach$(callbackfn: (value: Observable<V>, key: K) => void): void
  • Will call the function for each observable-key value in the map.

    Parameters

    • callbackfn: (value: Observable<V>, key: K) => void

      function to execute on the maps key-value

        • (value: Observable<V>, key: K): void
        • Parameters

          • value: Observable<V>
          • key: K

          Returns void

    Returns void

get$

  • get$(key: K): Observable<V>

has

  • has(key: K): boolean
  • Check if a key exists on the map

    Parameters

    • key: K

      to check for

    Returns boolean

    check if the key exists

keys

  • keys(): IterableIterator<K>

set

  • set(key: K, value: V): this
  • Set a key-value pair. This will create a SupportedSubjectTypes (or reuse if key already existed) for the key specified. It will call .next(value) on that subject.

    Parameters

    • key: K

      key to index value

    • value: V

      value to store

    Returns this

values$

  • values$(): IterableIterator<Observable<V>>

Generated using TypeDoc