fynjs API
    Preparing search index...

    Class Inflight<V>

    Keyed store of in-progress work, with start-time and last-check-time tracking.

    This is the generic core: it stores any value type V under any RecordKey and knows nothing about promises. Inflight builds promise deduplication on top of it.

    item-queue uses this directly - it tracks { item, promise } records keyed by an incrementing number, which is neither a promise nor a string, so it needs the core rather than Inflight (FJM-26).

    Type Parameters

    • V = unknown

      The type of the tracked value.

    Index
    • Type Parameters

      • V = unknown

        The type of the tracked value.

      Returns Inflight<V>

    _inflights: Map<RecordKey, InflightRecord<V>>

    Map of inflight items by key

    • get count(): number

      The number of inflight items.

      Returns number

    • get isEmpty(): boolean

      Whether there are no inflight items.

      Returns boolean

    • Track a value under a key.

      Parameters

      Returns V

      If key already exists.

    • Alias for lastCheckTime.

      Parameters

      Returns number

    • Alias for time.

      Parameters

      Returns number

    • Iterate the tracked items as [key, record] pairs.

      Prefer this over reaching for the internal map - it is what lets a caller sweep every in-progress entry, which is what item-queue's overdue-work watcher does.

      Returns IterableIterator<[RecordKey, InflightRecord<V>]>

    • Get the tracked value for a key, or undefined.

      Parameters

      Returns V

    • Get the last check time (ms since epoch) for a key, or undefined.

      Parameters

      Returns number

    • Get the start time (ms since epoch) for a key, or undefined.

      Parameters

      Returns number

    • Elapsed ms since the last check for a key, or -1 if not found.

      Parameters

      Returns number

    • Remove the inflight item for a key.

      Parameters

      Returns void

      If key does not exist.

    • Reset the last check time for a key, or for all inflight items if no key is given.

      Parameters

      Returns this

      This instance for chaining.

    • Elapsed ms since the start for a key, or -1 if not found.

      Parameters

      Returns number