diff --git a/src/common/utils/EventTask.ts b/src/common/utils/EventTask.ts new file mode 100644 index 00000000..d0df4c00 --- /dev/null +++ b/src/common/utils/EventTask.ts @@ -0,0 +1,33 @@ +import { randomUUID } from "crypto"; +export interface NTEventType { + EventName: string, + EventFunction: Function, + ListenerName: string, + ListenerFunction: Function +} +export class NTEvent { + EventData: NTEventType; + EventTask: Map = new Map(); + constructor(params: NTEventType) { + params.ListenerFunction = this.DispatcherListener; + this.EventData = params; + } + async DispatcherListener(...args: any[]) { + for (let task of this.EventTask.values()) { + if (task instanceof Promise) { + await task(...args); + } + task(...args); + } + } + async Call(params: T & { checker?: Function }) { + + } + async CallWaitTwice(params: T & { checker?: Function }) { + + } + async CallWaitVoid(param: T & { checker?: Function }) { + + } +} +