A reactive set.

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

Reads from and writes to this set are reactive.

interface ReactiveSet<V> {
    size: number;
    "[iterator]"(): IterableIterator<V>;
    add(value: V): this;
    clear(): void;
    delete(value: V): boolean;
    entries(): IterableIterator<[value: V, value: V]>;
    forEach(callback: (value: V, key: V) => void): void;
    has(value: V): boolean;
    values(): IterableIterator<V>;
}

Type Parameters

  • V

Hierarchy

  • Iterable<V>
    • ReactiveSet

Methods

  • Returns an iterator over the values in this set.

    Returns IterableIterator<V>

  • Removes the given value from this set. Returns true if value was a previously in this set, or false otherwise.

    Parameters

    • value: V

    Returns boolean

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

    NOTE: This is actually in the JS Standard..

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

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

    See also Set.forEach.

    Parameters

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

    Returns void

  • Returns true if the set currently contains the given value, false otherwise.

    Parameters

    • value: V

    Returns boolean

  • Returns an iterator over the values in this set.

    Returns IterableIterator<V>

Properties

size: number

Returns the current number of entries.