@shimotsuki/core 2.0.43 → 2.0.44
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/dist/index.d.ts +6 -0
- package/dist/shimotsuki_core.js +19 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1036,6 +1036,12 @@ declare class Manager {
|
|
|
1036
1036
|
boot(): Promise<void>;
|
|
1037
1037
|
/**合并对象 */
|
|
1038
1038
|
merge<K extends keyof Manager, T extends object>(target: K, source: T): this;
|
|
1039
|
+
/**
|
|
1040
|
+
* 注册一个“插件级”初始化回调
|
|
1041
|
+
* - 如果已初始化,立即执行
|
|
1042
|
+
* - 否则排队到 onPlugInInitDelegate 中
|
|
1043
|
+
*/
|
|
1044
|
+
appendPlugInInitDelegate(cb: () => Promise<void> | void): this;
|
|
1039
1045
|
}
|
|
1040
1046
|
declare const cat: Manager;
|
|
1041
1047
|
|
package/dist/shimotsuki_core.js
CHANGED
|
@@ -2335,7 +2335,7 @@ class WrapperSocialGameClient extends SocialGameClient {
|
|
|
2335
2335
|
subscribe(route, respType, fn) {
|
|
2336
2336
|
super.subscribe(route, respType, (data) => {
|
|
2337
2337
|
if (DEBUG && !this.ignore(route)) {
|
|
2338
|
-
log(`%c ws服务端消息:[${new Date()}] %c ${route} %c`, 'background:#35495e ; padding: 1px; border-radius: 3px 0 0 3px; color: #fff', 'background:#410083 ; padding: 1px; border-radius: 0 3px 3px 0; color: #fff', 'background:transparent', clone(respType, data));
|
|
2338
|
+
log(`%c ws服务端消息:[subscribe][${new Date()}] %c ${route} %c`, 'background:#35495e ; padding: 1px; border-radius: 3px 0 0 3px; color: #fff', 'background:#410083 ; padding: 1px; border-radius: 0 3px 3px 0; color: #fff', 'background:transparent', clone(respType, data));
|
|
2339
2339
|
}
|
|
2340
2340
|
cat.event.emit(route, clone(respType, data));
|
|
2341
2341
|
fn?.(data);
|
|
@@ -2912,6 +2912,24 @@ class Manager {
|
|
|
2912
2912
|
Object.assign(Reflect.get(this, target), source);
|
|
2913
2913
|
return this;
|
|
2914
2914
|
}
|
|
2915
|
+
/**
|
|
2916
|
+
* 注册一个“插件级”初始化回调
|
|
2917
|
+
* - 如果已初始化,立即执行
|
|
2918
|
+
* - 否则排队到 onPlugInInitDelegate 中
|
|
2919
|
+
*/
|
|
2920
|
+
appendPlugInInitDelegate(cb) {
|
|
2921
|
+
if (this.#initialized) {
|
|
2922
|
+
// 已经初始化:异步立即执行
|
|
2923
|
+
Promise.resolve().then(cb).catch(err => {
|
|
2924
|
+
console.error('[CAT] appendPlugInInitDelegate 回调执行失败:', err);
|
|
2925
|
+
});
|
|
2926
|
+
}
|
|
2927
|
+
else {
|
|
2928
|
+
// 未初始化:注册到插件初始化队列
|
|
2929
|
+
this.onPlugInInitDelegate.add(cb);
|
|
2930
|
+
}
|
|
2931
|
+
return this;
|
|
2932
|
+
}
|
|
2915
2933
|
}
|
|
2916
2934
|
const cat = Manager.instance;
|
|
2917
2935
|
/**
|