Class AsyncMap<T>

Type Parameters

  • T = unknown

Hierarchy

  • AsyncMap

Constructors

Properties

Accessors

Methods

Constructors

Properties

_distributer: Distributor<{
    key: string;
    value: T;
}>
_map: Map<string, T>

Accessors

Methods

  • Get a key from the map. Will return undefined if not found.

    Parameters

    • key: string

      Key to find

    • Optional defaultValue: T

      Value to use if key is not found

    Returns T

  • Parameters

    • handlerFn: ((event: {
          key: string;
          value: T;
      }) => void)
        • (event: {
              key: string;
              value: T;
          }): void
        • Parameters

          • event: {
                key: string;
                value: T;
            }
            • key: string
            • value: T

          Returns void

    Returns string

  • Asynchronously wait for a key to be inserted into the map. Will persist the key in the map in addition to returning it.

    Parameters

    • key: string

      Key to wait for

    • timeout: number = 5000

      Timeout before error is thrown in ms

    Returns Promise<T>

Generated using TypeDoc