UNPKG

browser-debugger-cli

Version:

DevTools telemetry in your terminal. For humans and agents. Direct WebSocket to Chrome's debugging port.

57 lines 1.34 kB
/** * Pending Request Manager * * Manages pending IPC requests with timeout handling. * Tracks requests waiting for worker responses and handles cleanup. */ /** * Manages pending requests with automatic timeout cleanup. */ export class PendingRequestManager { pending = new Map(); /** * Add a pending request with timeout. */ add(requestId, request) { this.pending.set(requestId, request); } /** * Get a pending request by ID. */ get(requestId) { return this.pending.get(requestId); } /** * Remove a pending request and clear its timeout. */ remove(requestId) { const request = this.pending.get(requestId); if (request) { clearTimeout(request.timeout); this.pending.delete(requestId); } return request; } /** * Get all pending requests. */ getAll() { return this.pending.entries(); } /** * Get number of pending requests. */ get size() { return this.pending.size; } /** * Clear all pending requests and their timeouts. */ clear() { for (const [, request] of this.pending) { clearTimeout(request.timeout); } this.pending.clear(); } } //# sourceMappingURL=pendingRequests.js.map