Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ObservableMap<T>

A concrete implementation of IObservbleMap. The namespace for ObservableMap class statics.

Type parameters

  • T

Hierarchy

Implements

Index

Constructors

constructor

Properties

Private _changed

_changed: Signal<this, IChangedArgs<T>> = new Signal<this, IObservableMap.IChangedArgs<T>>(this)

Private _isDisposed

_isDisposed: boolean = false

Private _itemCmp

_itemCmp: function

Type declaration

    • (first: T, second: T): boolean
    • Parameters

      • first: T
      • second: T

      Returns boolean

Private _map

_map: Map<string, T> = new Map<string, T>()

Accessors

changed

isDisposed

  • get isDisposed(): boolean

size

  • get size(): number

type

  • get type(): "Map"

Methods

clear

  • clear(): void

delete

  • delete(key: string): T | undefined
  • Remove a key from the map

    Parameters

    • key: string

      the key to remove.

    Returns T | undefined

    the value of the given key, or undefined if that does not exist.

    Notes

    This is a no-op if the value does not change.

dispose

  • dispose(): void

get

  • get(key: string): T | undefined
  • Get a value for a given key.

    Parameters

    • key: string

      the key.

    Returns T | undefined

    the value for that key.

has

  • has(key: string): boolean
  • Check whether the map has a key.

    Parameters

    • key: string

      the key to check.

    Returns boolean

    true if the map has the key, false otherwise.

keys

  • keys(): string[]
  • Get a list of the keys in the map.

    Returns string[]

    • a list of keys.

set

  • set(key: string, value: T): T | undefined
  • Set a key-value pair in the map

    throws

    if the new value is undefined.

    Notes

    This is a no-op if the value does not change.

    Parameters

    • key: string

      The key to set.

    • value: T

      The value for the key.

    Returns T | undefined

    the old value for the key, or undefined if that did not exist.

values

  • values(): T[]
  • Get a list of the values in the map.

    Returns T[]

    • a list of values.

Generated using TypeDoc