@schie/queue - v1.0.0
    Preparing search index...

    Class Queue

    Index

    Constructors

    Properties

    onStatusChange?: (status: QueueStatus) => void

    Accessors

    • get isCancelled(): boolean

      True after cancellation has been requested.

      Returns boolean

    • get isIdle(): boolean

      True when there is no runner and no pending work.

      Returns boolean

    • get isPaused(): boolean

      True when processing is paused.

      Returns boolean

    • get isProcessing(): boolean

      True when the queue is actively processing tasks.

      Returns boolean

    • get lastTaskError(): Error | null

      Captured error from the last failed task when pause-on-error is enabled.

      Returns Error | null

    • get size(): number

      Number of tasks waiting to be processed.

      Returns number

    Methods

    • Enqueues a task to run next (ahead of other pending tasks) without preempting the current task.

      Parameters

      • task: () => Promise<void>

      Returns void

    • Enqueues a new task and starts processing if idle, resurrecting a cancelled queue.

      Parameters

      • task: () => Promise<void>

      Returns void

    • Cancels all pending work, clears the queue, and prevents further status flips from stale runners.

      Returns void

    • Clears the stored lastTaskError value.

      Returns void

    • Removes all pending tasks without altering status when processing or paused.

      Returns void

    • Pauses processing after the current task completes.

      Returns void

    • Resumes processing, clearing any stored error when leaving a paused state.

      Returns void