mirror of
https://github.com/louislam/dockge.git
synced 2024-12-05 00:04:03 +00:00
16 lines
401 B
TypeScript
16 lines
401 B
TypeScript
|
export class AgentSocket {
|
||
|
|
||
|
eventList : Map<string, (...args : unknown[]) => void> = new Map();
|
||
|
|
||
|
on(event : string, callback : (...args : unknown[]) => void) {
|
||
|
this.eventList.set(event, callback);
|
||
|
}
|
||
|
|
||
|
call(eventName : string, ...args : unknown[]) {
|
||
|
const callback = this.eventList.get(eventName);
|
||
|
if (callback) {
|
||
|
callback(...args);
|
||
|
}
|
||
|
}
|
||
|
}
|