A reactive map.

This map interface is designed to be very similar to (but not exactly the same as) the standard JavaScript Map.

Reads from and writes to this map are reactive.

interface ReactiveMap<K, V> {
    size: number;
    "[iterator]"(): IterableIterator<[key: K, value: V]>;
    clear(): void;
    delete(key: K): boolean;
    entries(): IterableIterator<[key: K, value: V]>;
    forEach(callback: (value: V, key: K) => void): void;
    get(key: K): undefined | V;
    has(key: K): boolean;
    keys(): IterableIterator<K>;
    set(key: K, value: V): this;
    values(): IterableIterator<V>;
}

Type Parameters

  • K
  • V

Hierarchy

  • Iterable<[key: K, value: V]>
    • ReactiveMap

Methods

  • Returns an iterator over the [key, value] entries in this map.

    Returns IterableIterator<[key: K, value: V]>

  • Removes the entry for the given key. Returns true if there was such an entry, or false otherwise.

    Parameters

    • key: K

    Returns boolean

  • Returns an iterator over the [key, value] entries in this map.

    Returns IterableIterator<[key: K, value: V]>

  • Executes the given callback for every entry of the map.

    See also Map.forEach.

    Parameters

    • callback: (value: V, key: K) => void

    Returns void

  • Returns the currently associated value for the given key, or undefined if there is no such value.

    Parameters

    • key: K

    Returns undefined | V

  • Returns true if the map currently has an entry for the given key, false otherwise.

    Parameters

    • key: K

    Returns boolean

  • Returns an iterator over the keys in this map.

    Returns IterableIterator<K>

  • Associates the given key with value.

    Parameters

    • key: K
    • value: V

    Returns this

  • Returns an iterator over the values in this map.

    Returns IterableIterator<V>

Properties

size: number

Returns the current number of entries.