import { LoLEvent } from "../../data/LoLEvents.js"; export interface Subscription { unsubscribe(): void; readonly filter?: (e: LoLEvent) => boolean; readonly eventHandler: (event: LoLEvent) => void; } export type FetchOptions = { /** * Interval in milliseconds | default: 1000 */ interval?: number; /** * Max retries before giving up | default: 100 */ maxRetries?: number; /** * Callback for errors. */ onError?: (err: Error) => void; /** * Callback for max retries reached */ onMaxRetriesReached?: (err: Error) => void; /** * Disables error logging to console */ disableErrorLogging?: boolean; }; /** * Handles fetching of events from the Riot API and notifies observers about new events */ export declare class LoLEventManager { private readonly fetchInterval; private readonly maxRetries; private readonly onError?; private readonly onMaxRetriesReached?; private readonly disableErrorLogging; private timer?; private observers; private latestEventIndex; private retryCount; private running; private inFlight; constructor(fetchOptions?: FetchOptions); isFetching(): boolean; /** * Starts fetching events from the Riot API. Fetching stops when max retries reached or is manually stopped. */ startFetching(): void; private tick; /** * Stops fetching events. */ stopFetching(): void; /** * Subscribe to new events * @param eventHandler event handler * @param filter optional filter function. Only events that pass the filter will be notified */ subscribe(eventHandler: (event: LoLEvent) => void, filter?: (e: LoLEvent) => boolean): Subscription; /** * Unsubscribe from events. Better use the returned subscription object from {@link subscribe} * @param eventHandler event handler to unsubscribe * @param filter optional filter function. Only events that pass the filter will be notified */ unsubscribe(eventHandler: (event: LoLEvent) => void, filter?: (e: LoLEvent) => boolean): void; } //# sourceMappingURL=EventManager.d.ts.map