Ghost System Test - Async Queue Handler

    A test snippet for verifying the ghost interaction system with notifications

    Language: typescript

    Author: Umut Bayraktar (@umut)

    3 stars · 28 views

    Ghost System Test - Async Queue Handler

    Public
    • Updated Jan 11, 2026
    3
    ghost-system-test---async-queue-handler.ts
    class AsyncQueue<T> {
      private queue: T[] = [];
      private processing = false;
      
      async enqueue(item: T, processor: (item: T) => Promise<void>) {
        this.queue.push(item);
          await this.processQueue(processor);
        }
      }
      
      private async processQueue(processor: (item: T) => Promise<void>) {
        this.processing = true;
        while (this.queue.length > 0) {
          await processor(item);
        }
        this.processing = false;
      }
    }
    export { AsyncQueue };

    About

    A test snippet for verifying the ghost interaction system with notifications

    3stars
    28views
    Created Jan 11, 2026