import type { AnyExecutionContext } from '../../../../framework-types/execution-context/ExecutionContext';
import type { Task } from '../../../../framework-types/task/Types';
import type { Unsubscribe } from '../../../Types';
export type EventListenerEffect = typeof EventListenerEffectFactory;
type EventMap<T extends EventTarget> = {
    [K in keyof T as K extends `on${infer E}` ? E : never]: T[K] extends null | ((event: infer A) => void) ? A : never;
} & {
    [key: string | symbol]: Event;
};
export type ElementEventMap<Element extends EventTarget> = EventMap<Element>;
type EventSubscriber<Ctx extends AnyExecutionContext, Element extends EventTarget, EventKey extends keyof ElementEventMap<Element>> = Task<Ctx, ElementEventMap<Element>[EventKey], any>;
/**
 * EventListenerEffectFactory
 * Ensures structured concurrency is honored by automatically removing HTMLElement event listeners
 * when execution of the associated `Task` finishes.
 *
 * We want to make sure we remove listeners once the thread has finished running, instead of achieving this by manually
 * removing events when `AbortSignal.aborted` on the outside, we can introduce an `Effect` that will do this for us
 * automatically. This is where `EventListenerEffectFactory` comes into place.
 *
 * It keeps track of all added listeners, and removes them when the effect is removed.
 */
export declare const EventListenerEffectFactory: import("../../../../framework-types/effect/Types").EffectFactory<AnyExecutionContext, {
    events: {
        subscribe: <Ctx extends AnyExecutionContext, Element_1 extends EventTarget, EventKey extends string | number | symbol | keyof { [K in keyof Element_1 as K extends `on${infer E}` ? E : never]: Element_1[K] extends ((event: infer A) => void) | null ? A : never; }>(context: Ctx, element: Element_1, event: EventKey, subscriber: EventSubscriber<Ctx, Element_1, EventKey>) => Unsubscribe;
    };
}>;
export {};
