tools_dj 1.0.43 → 1.0.45
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/lib/msg.d.ts +30 -0
- package/lib/msg.js +1 -0
- package/package.json +3 -2
package/lib/msg.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import mitt from 'mitt';
|
|
2
|
+
/** 2024/12/24 17:37 User: DJ
|
|
3
|
+
* content: 垮页面之间的消息发送
|
|
4
|
+
*/
|
|
5
|
+
export declare function pageSend(type: any, data: any): void;
|
|
6
|
+
/** 2025/1/5 12:48 User: DJ
|
|
7
|
+
* content: 跨页面消息
|
|
8
|
+
*/
|
|
9
|
+
export declare function pageRead(type: any, callBack: any): void;
|
|
10
|
+
/** 2024/12/24 17:52 User: DJ
|
|
11
|
+
* content: store 消息接收针对于当前页面比较实用,注意只有当store 发生变动的时候才会触发
|
|
12
|
+
*/
|
|
13
|
+
declare function storeRead(store: any, callBack: any): void;
|
|
14
|
+
/** 2024/12/25 10:05 User: DJ
|
|
15
|
+
* content: bus 消息发送 即使数据相同也可以触发
|
|
16
|
+
*/
|
|
17
|
+
declare function busSend(type: any, data: any): void;
|
|
18
|
+
/** 2024/12/25 10:05 User: DJ
|
|
19
|
+
* content: bus 消息接收 注意消息接收应当在消息发送之前不然接收不到消息
|
|
20
|
+
*/
|
|
21
|
+
declare function busRead(type: any, callBack: any): void;
|
|
22
|
+
declare const _default: {
|
|
23
|
+
pageSend: typeof pageSend;
|
|
24
|
+
pageRead: typeof pageRead;
|
|
25
|
+
storeRead: typeof storeRead;
|
|
26
|
+
busSend: typeof busSend;
|
|
27
|
+
busRead: typeof busRead;
|
|
28
|
+
mitt: typeof mitt;
|
|
29
|
+
};
|
|
30
|
+
export default _default;
|
package/lib/msg.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:!0}),exports.pageSend=s,exports.pageRead=o;const e=require("tslib");let t=new BroadcastChannel("msgCenter");const a=e.__importDefault(require("mitt")),n=(0,a.default)();function s(e,a){t.postMessage({type:e,data:a})}function o(e,a){t.onmessage=({data:t})=>{e==t.type&&a&&a(t.data)}}exports.default={pageSend:s,pageRead:o,storeRead:function(e,t){e.$subscribe(((e,a)=>{t&&t(a)}))},busSend:function(e,t){n.emit(e,t)},busRead:function(e,t){n.on(e,(e=>{t&&t(e)}))},mitt:a.default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tools_dj",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.45",
|
|
4
4
|
"description": "dj tools 工具库",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"module": "./lib/index.js",
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"lib"
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"glob": "^11.0.1"
|
|
32
|
+
"glob": "^11.0.1",
|
|
33
|
+
"mitt": "^3.0.1"
|
|
33
34
|
}
|
|
34
35
|
}
|