import { Logger } from './logger.js'; import { ExtEventSource } from './request-factory.js'; export interface FetchEventSource { addEventListener(type: K, listener: (this: EventSource, ev: EventSourceEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; removeEventListener(type: K, listener: (this: EventSource, ev: EventSourceEventMap[K]) => any, options?: boolean | EventListenerOptions): void; } export declare class FetchEventSource extends EventTarget implements ExtEventSource { private static readonly LAST_EVENT_ID_HEADER; private static readonly MAX_RETRY_TIME_MULTIPLIER; private static readonly RETRY_EXPONENT; private static readonly EVENT_TIMEOUT_DEFAULT; private static readonly EVENT_TIMEOUT_CHECK_INTERVAL_DEFAULT; readonly CONNECTING = 0; readonly OPEN = 1; readonly CLOSED = 2; readyState: number; url: string; withCredentials: boolean; onerror: ((this: EventSource, ev: Event) => unknown) | null; onmessage: ((this: EventSource, ev: MessageEvent) => unknown) | null; onopen: ((this: EventSource, ev: Event) => unknown) | null; get retryTime(): number; private readonly adapter; private readonly signal?; private connectionAbortController?; private connectionReader?; private externalAbortSignal?; private externalAbortHandler?; private internalRetryTime; private retryAttempt; private connectionAttemptTime; private connectionOrigin?; private reconnectTimeoutHandle?; private lastEventId?; private readonly logger?; private readonly eventTimeout?; private readonly eventTimeoutCheckInterval; private eventTimeoutCheckHandle?; private lastEventReceivedTime; private readonly eventParser; constructor(url: string, eventSourceInit?: EventSourceInit & { adapter?: (url: string, requestInit: RequestInit) => Promise; signal?: AbortSignal; eventTimeout?: number; eventTimeoutCheckInterval?: number; logger?: Logger; }); connect(): void; private internalConnect; close(): void; private internalClose; private updateLastEventReceived; private startEventTimeoutCheck; private stopEventTimeoutCheck; private checkEventTimeout; private receivedHeaders; private receivedData; private receivedError; private receivedComplete; private scheduleReconnect; private static calculateRetryTime; private clearReconnect; private readonly dispatchParsedEvent; fireErrorEvent(error: unknown): void; private abortConnection; }