EventBus: Add ability to tag events with arbitrary classification meta (#82087)

This commit is contained in:
Leon Sorokin
2024-02-08 16:15:32 -06:00
committed by GitHub
parent 829672759c
commit 930c8c5aa3
5 changed files with 30 additions and 12 deletions
+12
View File
@@ -19,10 +19,22 @@ export abstract class BusEventBase implements BusEvent {
readonly payload?: any;
readonly origin?: EventBus;
/** @internal */
tags?: Set<string>;
constructor() {
//@ts-ignore
this.type = this.__proto__.constructor.type;
}
/**
* @internal
* Tag event for finer-grained filtering in subscribers
*/
setTags(tags: string[]) {
this.tags = new Set(tags);
return this;
}
}
/**