# smallEventBus **Repository Path**: lsw_space/small-event-bus ## Basic Information - **Project Name**: smallEventBus - **Description**: No description available - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-02-13 - **Last Updated**: 2025-04-21 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ## 简介 小巧简单的事件发布订阅中心 ## 使用 1. 安装 ```js npm install small-event-bus ``` 2. 使用 ```js //订阅事件 import smallEventBus from "./index.js"; function aHander(arg) { console.log("订阅事件接受的参数", arg); return "aHander Done"; } smallEventBus.subScrible("a", aHander); //发布事件 const callBackData = smallEventBus.public("a", { name: "test", desc: "测试数据", }); console.log("发布后返回的参数", callBackData); ``` ## api | 方法 | 描述 | | :------------- | :------- | | subScrible | 订阅 | | subScribleOnce | 单次订阅 | | public | 发布 | | unSubscrible | 取消订阅 |