module-develop-kit 0.5.5 → 0.5.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/index.es.js +15568 -15567
  2. package/dist/main.d.ts +40 -0
  3. package/package.json +2 -2
package/dist/main.d.ts CHANGED
@@ -83,6 +83,46 @@ export declare const EMIT_EVENT_NAME: {
83
83
  UPDATE_STATUS: string;
84
84
  };
85
85
 
86
+ export declare class EventBus implements EventBusProps {
87
+ private _eventList;
88
+ private _toString;
89
+ /**
90
+ * 监听
91
+ * @param {string} eventName 需要监听的名字
92
+ * @param {Function} callback 监听触发的回调
93
+ * @param immediate 是否立即执行
94
+ * */
95
+ $on(eventName: string, callback: EventFnc, immediate?: boolean): void;
96
+ /**
97
+ * 分发事件
98
+ * @param {string} eventName 需要分发的监听的名字
99
+ * @param { any } args 传递的参数
100
+ * */
101
+ $emit(eventName: string, ...args: any): Promise<void | void[]>;
102
+ /**
103
+ * 取消监听
104
+ * @param {string | Array<string>} eventName 需要取消的监听名称
105
+ * */
106
+ $off(eventName?: string | string[]): void;
107
+ /**
108
+ * 执行一次的监听之后立即销毁
109
+ * @param {string} eventName 需要监听的名字
110
+ * @param {Function} callback 监听触发的回调
111
+ * */
112
+ $once(eventName: string, callback: EventFnc): void;
113
+ private _findEvent;
114
+ private _addEvent;
115
+ }
116
+
117
+ export declare interface EventBusProps {
118
+ $on(eventName: string, callback: EventFnc, immediate: boolean): void;
119
+ $emit(eventName: string, ...args: any): void;
120
+ $off(eventName?: string | string[]): void;
121
+ $once(eventName: string, callback: EventFnc): void;
122
+ }
123
+
124
+ declare type EventFnc = (...args: any) => void;
125
+
86
126
  /**
87
127
  * 生成指定长度的随机字符串。
88
128
  * 该函数通过从包含大小写字母和数字的字符集合中随机选取字符,拼接成所需长度的字符串。
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "module-develop-kit",
3
3
  "author": "Front-End team",
4
- "version": "0.5.5",
4
+ "version": "0.5.6",
5
5
  "type": "module",
6
6
  "description": "前端项目通用工具包",
7
7
  "module": "dist/index.es.js",
@@ -15,7 +15,7 @@
15
15
  "exports": {
16
16
  ".": {
17
17
  "import": "./dist/index.es.js",
18
- "types": "./dist/index.d.ts",
18
+ "types": "./dist/main.d.ts",
19
19
  "default": "./dist/index.es.js"
20
20
  },
21
21
  "./vite-plugins": {