UNPKG

@cloud-copilot/iam-lens

Version:

Visibility in IAM in and across AWS accounts

35 lines 980 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ArrayStreamingWorkQueue = void 0; class ArrayStreamingWorkQueue { onWorkAvailable; notifyScheduled = false; work = []; constructor(options = {}) { } setWorkAvailableCallback(callback) { this.onWorkAvailable = callback; } enqueue(item) { this.work.push(item); this.scheduleNotify(); } dequeue() { return this.work.shift(); } length() { return this.work.length; } scheduleNotify() { if (this.notifyScheduled || !this.onWorkAvailable) { return; } this.notifyScheduled = true; // Use a microtask to debounce notifications queueMicrotask(() => { this.notifyScheduled = false; this.onWorkAvailable?.(); }); } } exports.ArrayStreamingWorkQueue = ArrayStreamingWorkQueue; //# sourceMappingURL=ArrayStreamingWorkQueue.js.map