@base-web-kits/base-tools-ts 1.1.10 → 1.1.18-alpha.1

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.
package/package.json CHANGED
@@ -1,36 +1,39 @@
1
- {
2
- "name": "@base-web-kits/base-tools-ts",
3
- "version": "1.1.10",
4
- "sideEffects": false,
5
- "description": "Independent TS utilities package built from src/ts.",
6
- "keywords": [
7
- "base-tools",
8
- "ts",
9
- "utilities"
10
- ],
11
- "license": "MIT",
12
- "main": "./dist/index.cjs",
13
- "module": "./dist/index.js",
14
- "types": "./dist/index.d.ts",
15
- "exports": {
16
- ".": {
17
- "types": "./dist/index.d.ts",
18
- "import": "./dist/index.js",
19
- "require": "./dist/index.cjs"
20
- }
21
- },
22
- "files": [
23
- "dist",
24
- "README.md",
25
- "src"
26
- ],
27
- "dependencies": {
28
- "es-toolkit": "^1.42.0",
29
- "bignumber.js": "^9.1.2",
30
- "dayjs": "^1.11.19",
31
- "mitt": "^3.0.1"
32
- },
33
- "publishConfig": {
34
- "registry": "https://registry.npmjs.org"
35
- }
36
- }
1
+ {
2
+ "name": "@base-web-kits/base-tools-ts",
3
+ "version": "1.1.18-alpha.1",
4
+ "sideEffects": false,
5
+ "description": "Independent TS utilities package built from src/ts.",
6
+ "keywords": [
7
+ "base-tools",
8
+ "ts",
9
+ "utilities"
10
+ ],
11
+ "license": "MIT",
12
+ "main": "./dist/index.cjs",
13
+ "module": "./dist/index.js",
14
+ "types": "./dist/index.d.ts",
15
+ "exports": {
16
+ ".": {
17
+ "types": "./dist/index.d.ts",
18
+ "import": "./dist/index.js",
19
+ "require": "./dist/index.cjs"
20
+ }
21
+ },
22
+ "files": [
23
+ "dist",
24
+ "README.md",
25
+ "src"
26
+ ],
27
+ "dependencies": {
28
+ "es-toolkit": "^1.42.0",
29
+ "bignumber.js": "^9.1.2",
30
+ "dayjs": "^1.11.19",
31
+ "mitt": "^3.0.1"
32
+ },
33
+ "peerDependencies": {
34
+ "dayjs": "^1.0.0"
35
+ },
36
+ "publishConfig": {
37
+ "registry": "https://registry.npmjs.org"
38
+ }
39
+ }
@@ -4,16 +4,7 @@ type Events = Record<EventType, unknown>;
4
4
 
5
5
  /**
6
6
  * 总线式发布订阅
7
- * @example
8
- * const emitter = new EventBus(); // 支持链式调用
9
- * emitter.on('xx', fn); // 订阅事件 xx
10
- * emitter.once('xx', fn); // 订阅事件 xx 一次
11
- * emitter.emit('xx', any); // 发布事件 xx,参数任意
12
- * emitter.off('xx'); // 移除事件 xx 下全部监听
13
- * emitter.off('xx', fn); // 移除事件 xx 下指定监听
14
- * emitter.clear(); // 移除所有事件
15
- *
16
- * @example 类型约束
7
+ * @example 创建实例调用 (支持类型约束)
17
8
  * type T = { a: number; b: string };
18
9
  * const emitter = new EventBus<{ xx: T; yy: void }>();
19
10
  * const fn = (arg: T) => {}
@@ -59,3 +50,15 @@ export class EventBus<T extends Events = Events> {
59
50
  return this;
60
51
  }
61
52
  }
53
+
54
+ /**
55
+ * 全局事件总线
56
+ * @example 静态调用 (支持链式)
57
+ * EventBus.on('xx', fn); // 订阅事件 xx
58
+ * EventBus.once('xx', fn); // 订阅事件 xx 一次
59
+ * EventBus.emit('xx', any); // 发布事件 xx,参数任意
60
+ * EventBus.off('xx'); // 移除事件 xx 下全部监听
61
+ * EventBus.off('xx', fn); // 移除事件 xx 下指定监听
62
+ * EventBus.clear(); // 移除所有事件
63
+ */
64
+ export default new EventBus();
@@ -1,7 +1,6 @@
1
1
  /**
2
2
  * re-export 全量 es-toolkit
3
3
  * 文档: https://es-toolkit.dev/
4
- * 目的: 从工具库统一es-toolkit版本,避免项目多个版本冲突
5
- * 注意: 需在tsup.config.ts加入noExternal: ['es-toolkit'],确保打包时不被忽略
4
+ * 目的: 提供常用工具,收敛依赖版本
6
5
  */
7
6
  export * from 'es-toolkit';