import { EventPayload, EventPayloadContext, IoptionsParams } from '../../types';
import { SDKMetaData, Service } from '../index';
/**
 * @author 江跃 <jiangbin.gjb@antgroup.com>
 * @date 2024/9/17
 */
export declare class EventCenter implements Service {
    private events;
    private iframes;
    private instanceId;
    constructor();
    /**
     * Initializes the event center
     */
    init(initOptions: IoptionsParams, instanceId: string, sdkMetaData: SDKMetaData): void;
    /**
     * Cleans up event listeners when the event center is destroyed.
     */
    destroy(): void;
    /**
     * Placeholder for future update logic.
     */
    update(): void;
    /**
     * Sets the iframe container and its domain.
     * @param iframe - The HTMLIFrameElement that serves as the container.
     * @param domain - The domain of the app.
     */
    addIFrame(iframe: HTMLIFrameElement): void;
    /**
     * Cleans iframes when web app close
     */
    cleanIFrames(): void;
    removeIFrame(iframe: HTMLIFrameElement): void;
    /**
     * Handles messages received from the app.
     * @param e - The message event.
     */
    private handleAppMessage;
    private checkEventCompliant;
    /**
     * Processes the application message and emits the associated event.
     * @param data - Parsed EventPayload from the app.
     */
    private _handleAppMessage;
    /**
     * Listens to an event by adding a callback function.
     * @param name - The name of the event to listen for.
     * @param func - The callback function to execute when the event is emitted.
     * @param isAppend - Append to event handlers as chain, default value is false
     */
    listen(name: string, func: IListener, isAppend?: boolean): void;
    /**
     * Unsubscribes from an event. If a function is provided, only that function is removed.
     * @param name - The name of the event to unlisten to.
     * @param func - The optional callback function to remove.
     */
    unlisten(name: string, func?: IListener): void;
    /**
     * Emits an event, executing all associated callback functions.
     * @param name - The name of the event to emit.
     * @param data - The event data to pass to the event listeners.
     */
    emit(name: string, data: any, eventPayload?: EventPayload): void;
    /**
     * Registers a callback for an event and immediately dispatches the event to the app.
     * @param payloadContext - The context containing event information and callback ID.
     * @param func - The callback function to execute when the event is emitted.
     */
    emitAndListen(payloadContext: EventPayloadContext, func: IListener): void;
    queryParse(url?: string): Record<string, any>;
    /**
     * Dispatches the event payload to the app via postMessage.
     * @param payloadContext - The context containing event to be dispatched.
     */
    dispatchToApp(payloadContext: EventPayloadContext): void;
    isExist(name: string): boolean;
}
interface IListener {
    (data: any, eventPayload?: EventPayload): void;
}
export {};
