Class WeakCache<K, V>

Type Parameters

  • K extends {}
  • V extends WeakKey = WeakKey

Constructors

Accessors

Methods

Constructors

  • Type Parameters

    • K extends {}
    • V extends WeakKey = WeakKey

    Parameters

    • Optionaliterable: null | Iterable<readonly [K, V], any, any>

    Returns WeakCache<K, V>

Accessors

Methods

  • Parameters

    • Optionaldispose: (value: V) => void

    Returns void

  • Removes the specified element from the WeakMap.

    Parameters

    • key: K

    Returns boolean

    true if the element was successfully removed, or false if it was not present.

  • Parameters

    • key: K

    Returns undefined | V

    a specified element.

  • Parameters

    • key: K

    Returns boolean

    a boolean indicating whether an element with the specified key exists or not.

  • Adds a new element with a specified key and value.

    Parameters

    • key: K

      Must be an object or symbol.

    • value: V

    Returns this

    this