Use actions/events for plugin interoperability. Move base case and mute functionality to their own plugins.
This commit is contained in:
parent
22c515be38
commit
2e30a3b9e7
14 changed files with 674 additions and 332 deletions
|
@ -28,11 +28,14 @@ export class QueuedEventEmitter {
|
|||
listeners.splice(listeners.indexOf(listener), 1);
|
||||
}
|
||||
|
||||
emit(eventName: string, args: any[] = []) {
|
||||
emit(eventName: string, args: any[] = []): Promise<void> {
|
||||
const listeners = [...(this.listeners.get(eventName) || []), ...(this.listeners.get("*") || [])];
|
||||
|
||||
let promise: Promise<any> = Promise.resolve();
|
||||
listeners.forEach(listener => {
|
||||
this.queue.add(listener.bind(null, ...args));
|
||||
promise = this.queue.add(listener.bind(null, ...args));
|
||||
});
|
||||
|
||||
return promise;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue