fix: 玄学的问题

This commit is contained in:
手瓜一十雪 2024-06-04 12:20:42 +08:00
parent 42c85224ba
commit d40230879c
3 changed files with 7 additions and 7 deletions

View File

@ -4,7 +4,7 @@ QQ Version: Windows 9.9.10-24108 / Linux 3.2.7-23361
## 修复与优化
* 支持 新Api: set_self_profile 可设置个性签名
* 修复 Api: get_group_system_msg
## 新增与调整

View File

@ -112,14 +112,13 @@ export class NTEventWrapper {
return new Promise<[EventRet: Awaited<ReturnType<EventType>>, ...Parameters<ListenerType>]>(async (resolve, reject) => {
const id = randomUUID();
let complete = 0;
let retData: ArrayLike<Parameters<ListenerType>> | undefined = undefined;
let retData: Parameters<ListenerType> | undefined = undefined;
let retEvent: any = {};
const databack = () => {
if (complete < waitTimes) {
reject(new Error('NTEvent EventName:' + EventName + ' ListenerName:' + ListenerName + ' timeout'));
} else {
resolve([retEvent as Awaited<ReturnType<EventType>>, ...(retData as Parameters<ListenerType>)]);
resolve([retEvent as Awaited<ReturnType<EventType>>, ...retData!]);
}
};
const Timeouter = setTimeout(databack, timeout);
@ -133,7 +132,7 @@ export class NTEventWrapper {
func: (...args: any[]) => {
complete++;
//console.log('func', ...args);
retData = args as ArrayLike<Parameters<ListenerType>>;
retData = args as Parameters<ListenerType>;
if (complete >= waitTimes) {
clearTimeout(Timeouter);
databack();
@ -149,7 +148,8 @@ export class NTEventWrapper {
this.EventTask.get(ListenerMainName)?.get(ListenerSubName)?.set(id, eventCallbak);
this.CreatListenerFunction(ListenerMainName);
const EventFunc = this.CreatEventFunction<EventType>(EventName);
retEvent = await EventFunc!(...args);
//console.log("测试打点", args);
retEvent = await EventFunc!(...(args as any[]));
});
}
}