@juulsgaard/signal-tools
    Preparing search index...

    Class SignalMap<TKey, TVal>

    A Map where the state and values are accessible as signals

    Type Parameters

    • TKey
    • TVal

    Implements

    Index

    Constructors

    Properties

    empty: Signal<boolean>

    A signal emitting true if the collection is empty

    size: Signal<number>

    A signal emitting the number of items in the collection

    value: Signal<ReadonlyMap<TKey, TVal>>

    A signal emitting the inner non-signal map

    Methods

    • Toggle a value in the map

      Parameters

      • key: TKey

        The key to toggle

      • value: TVal

        The value to insert if applicable

      • Optionalstate: boolean

        A forced state (true = always add, false = always delete)

      Returns boolean | undefined

      The applied change (true = item added, false = item removed, undefined = nothing changed)