import { useEffect } from 'react';
import { eventBus, AppEvent } from './EventBus';

export function useEventBus(handler: (event: AppEvent) => void): void {
  useEffect(() => {
    return eventBus.subscribe(handler);
  }, [handler]);
}
