import * as react from 'react';
import { FC } from 'react';

type Callback<T = unknown> = (args: T) => void;
declare class CozyEvent {
    private _events;
    on<T>(event: string, callback: Callback<T>): void;
    once<T>(event: string, callback: Callback<T>): void;
    off<T>(event: string, callback: Callback<T>): void;
    emit<T>(event: string, params?: T): void;
    emitAsync<T>(event: string, params?: T): void;
    removeAllListeners(event?: string): void;
}

interface CozyEventProviderProps {
    instance?: CozyEvent;
    children: React.ReactNode;
    id?: string;
}
interface UseCozyEventOptions {
    namespace?: string;
    id?: string;
}

declare const CozyEventProvider: FC<CozyEventProviderProps>;

declare const useCozyEvent: <T = any>(eventName: string, callback: (data: any) => void, options?: UseCozyEventOptions) => CozyEvent;

declare const CozyEventContext: react.Context<CozyEvent>;

declare const registerCozyEventInstance: (id: string, instance: CozyEvent) => void;
declare const getCozyEventInstanceById: (id: string) => CozyEvent | undefined;

export { CozyEvent, CozyEventContext, CozyEventProvider, getCozyEventInstanceById, registerCozyEventInstance, useCozyEvent };
