import { useEffect, useRef } from 'react';
import { eventBus } from '../utils/eventBus';
export function useMainwrapV4EventBus(eventName, handler) {
    const handlerRef = useRef(handler);
    useEffect(() => {
        handlerRef.current = handler;
    }, [handler]);
    useEffect(() => {
        const listener = (payload) => handlerRef.current(payload);
        eventBus.on(eventName, listener);
        return () => eventBus.off(eventName, listener);
    }, [eventName]);
}
//# sourceMappingURL=use-event-bus.js.map