@embra/reactivity - v0.0.3
    Preparing search index...

    Interface ReadonlyReactiveMap<K, V>

    interface ReadonlyReactiveMap<K, V> {
        $: Readable<ReadonlyMap<K, V>>;
        size: number;
        "[iterator]"(): MapIterator<[K, V]>;
        entries(): MapIterator<[K, V]>;
        forEach(
            callbackfn: (value: V, key: K, map: ReadonlyMap<K, V>) => void,
            thisArg?: any,
        ): void;
        get(key: K): undefined | V;
        has(key: K): boolean;
        keys(): MapIterator<K>;
        onChanged(fn: (changed: ReactiveMapChanged<K, V>) => void): RemoveListener;
        onDisposeValue(fn: (value: V) => void): RemoveListener;
        values(): MapIterator<V>;
    }

    Type Parameters

    • K
    • V

    Hierarchy

    • ReadonlyMap<K, V>
      • ReadonlyReactiveMap
    Index

    Properties

    $: Readable<ReadonlyMap<K, V>>
    size: number

    Methods

    • Returns an iterable of entries in the map.

      Returns MapIterator<[K, V]>

    • Returns an iterable of key, value pairs for every entry in the map.

      Returns MapIterator<[K, V]>

    • Parameters

      • callbackfn: (value: V, key: K, map: ReadonlyMap<K, V>) => void
      • OptionalthisArg: any

      Returns void

    • Parameters

      • key: K

      Returns undefined | V

    • Parameters

      • key: K

      Returns boolean

    • Returns an iterable of keys in the map

      Returns MapIterator<K>

    • Subscribe to events when a value is needed to be disposed.

      A value is considered for disposal when:

      • it is deleted from the map.
      • it is replaced by another value (the old value is removed).
      • it is cleared from the map.
      • the map is disposed.

      Note that for performance reasons, it does not handle the case where multiple keys map to the same value.

      Parameters

      • fn: (value: V) => void

        The function to call when a value is needed to be disposed.

      Returns RemoveListener

      A disposer function to unsubscribe from the event.

    • Returns an iterable of values in the map

      Returns MapIterator<V>