feat(notifications): control notifcation types per agent

closes #513
This commit is contained in:
sct
2020-12-28 02:21:45 +00:00
parent d00e470b55
commit 8af6a1f566
12 changed files with 410 additions and 91 deletions

View File

@@ -9,6 +9,27 @@ export enum Notification {
TEST_NOTIFICATION = 32,
}
export const hasNotificationType = (
types: Notification | Notification[],
value: number
): boolean => {
let total = 0;
// If we are not checking any notifications, bail out and return true
if (types === 0) {
return true;
}
if (Array.isArray(types)) {
// Combine all notification values into one
total = types.reduce((a, v) => a + v, 0);
} else {
total = types;
}
return !!(value & total);
};
class NotificationManager {
private activeAgents: NotificationAgent[] = [];