Pixel Data JS - v0.40.1
    Preparing search index...

    Function makeBatchedQueue

    • Creates a high-performance, zero-allocation batching queue. This utility collects items marked as "dirty" and flushes them in a single batch.

      • ⚠️ CRITICAL: Synchronous Processing Required Because the internal sets are reused, the Set passed to the processor is instantly cleared the moment the processor function returns. If you need to process the items asynchronously, you must manually clone the set inside your processor.

      Type Parameters

      • T

        The type of items being batched.

      Parameters

      • processor: (items: Set<T>) => void

        The callback executed when the batch flushes. Receives a Set of all batched items.

      • queue: BatchedQueueFn

        The scheduling function used to defer the flush. Defaults to queueMicrotask.

      Returns { markDirty: (item: T) => void; markMultipleDirty: (items: T[]) => void }

      An object containing methods to mark items as dirty.

      *
      
      import { nextTick } from 'vue'
      let bq = makeBatchedQueue<string>(
      (items) => drawSomething(items),
      nextTick,
      )