UNPKG

t-comm

Version:

专业、稳定、纯粹的工具库

31 lines (28 loc) 929 B
import { EventBus } from './e-bus.mjs'; var globalEBus = new EventBus(); /** * 挂载统一的eBus,所有实例共用一个 * @param app Vue3 应用实例 */ var initGlobalVue3EBus = function initGlobalVue3EBus(app) { var _a; if (!((_a = app === null || app === void 0 ? void 0 : app.config) === null || _a === void 0 ? void 0 : _a.globalProperties)) { return app; } app.config.globalProperties.$ebus = globalEBus; return [app, globalEBus]; }; /** * 挂载唯一的eBus,不同实例用不同的 * @param app Vue3 应用实例 */ var initDiffVue3EBus = function initDiffVue3EBus(app) { var _a; if (!((_a = app === null || app === void 0 ? void 0 : app.config) === null || _a === void 0 ? void 0 : _a.globalProperties)) { return app; } var eBus = new EventBus(); app.config.globalProperties.$ebus = eBus; return [app, eBus]; }; export { globalEBus, initDiffVue3EBus, initGlobalVue3EBus };