Options
All
  • Public
  • Public/Protected
  • All
Menu

Stores a map of objects with weak references to the keys, allowing them to be garbage collected. Both keys and values can be iterated over, unlike a WeakMap.

Hierarchy

  • WeakMap
    • IterableWeakMap

Index

Constructors

  • Parameters

    • entries: Iterable<[any, any]> = []

    Returns IterableWeakMap

Methods

  • delete(key: any): boolean
  • Remove a key from the map.

    Parameters

    • key: any

      The key to remove.

    Returns boolean

  • get(key: any): any
  • Retrieve a value from the map.

    Parameters

    • key: any

      The value's key.

    Returns any

  • Place a value in the map.

    Parameters

    • key: any

      The key.

    • value: any

      The value.

    Returns IterableWeakMap

  • entries(): Generator<[any, any], void, any>
  • Enumerate the entries.

    Returns Generator<[any, any], void, any>

  • keys(): Generator<any, void, any>
  • Enumerate the keys.

    Returns Generator<any, void, any>

  • values(): Generator<any, void, any>
  • Enumerate the values.

    Returns Generator<any, void, any>

  • [iterator](): Generator<[any, any], void, any>
  • Enumerate the entries.

    Returns Generator<[any, any], void, any>

  • Clean up the corresponding ref in the set when its value is garbage collected.

    Parameters

    Returns void

Properties

#refs: Set<WeakRef<any>> = ...

A set of weak refs to the map's keys, allowing enumeration.

#finalizer: FinalizationRegistry<IterableWeakMapHeldValue> = ...

A FinalizationRegistry instance to clean up the ref set when objects are garbage collected.