/**
 * 便捷的 Hook：获取当前应用实例的事件总线
 */ import { getAppInstanceManager } from "../startup/AppInstance";
/**
 * 获取当前应用实例的事件总线
 * 
 * @returns 事件总线实例
 * 
 * @example
 * ```tsx
 * import { useEventBus } from '@vlian/framework';
 * 
 * function MyComponent() {
 *   const eventBus = useEventBus();
 *   
 *   useEffect(() => {
 *     const unsubscribe = eventBus.on('user:login', (data) => {
 *       console.log('用户登录:', data);
 *     });
 *     return unsubscribe;
 *   }, [eventBus]);
 *   
 *   return <div>My Component</div>;
 * }
 * ```
 */ export function useEventBus() {
    const instanceManager = getAppInstanceManager();
    const instance = instanceManager.getInstance();
    if (!instance) {
        throw new Error('应用实例未找到');
    }
    const eventBus = instance.getEventBus();
    if (!eventBus) {
        throw new Error('事件总线未初始化');
    }
    return eventBus;
}

//# sourceMappingURL=useEventBus.js.map