mirror of
https://github.com/nasa/openmct.git
synced 2024-12-27 08:32:28 +00:00
Removed extractRoleFromEvent from ActiveRoleSynchronizer
This commit is contained in:
parent
81c33efc6e
commit
9050b7a2da
@ -16,13 +16,14 @@ class ActiveRoleSynchronizer {
|
||||
};
|
||||
}
|
||||
subscribeToRoleChanges(callback) {
|
||||
this.#roleChannel.addEventListener('message', this.extractRoleFromEvent(callback));
|
||||
this.#roleChannel.addEventListener('message', callback);
|
||||
}
|
||||
unsubscribeFromRoleChanges(callback) {
|
||||
this.#roleChannel.removeEventListener('message', this.extractRoleFromEvent(callback));
|
||||
this.#roleChannel.removeEventListener('message', callback);
|
||||
}
|
||||
|
||||
setActiveRoleFromChannelMessage(role) {
|
||||
setActiveRoleFromChannelMessage(event) {
|
||||
const role = event.data;
|
||||
this.openmct.user.setActiveRole(role);
|
||||
}
|
||||
broadcastNewRole(role) {
|
||||
|
@ -46,11 +46,11 @@ export default {
|
||||
async mounted() {
|
||||
this.getUserInfo();
|
||||
this.roleChannel = new ActiveRoleSynchronizer(this.openmct);
|
||||
this.roleChannel.subscribeToRoleChanges(this.setRoleSelection);
|
||||
this.roleChannel.subscribeToRoleChanges(this.onRoleChange);
|
||||
await this.fetchOrPromptForRole();
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.roleChannel.unsubscribeFromRoleChanges(this.setRoleSelection);
|
||||
this.roleChannel.unsubscribeFromRoleChanges(this.onRoleChange);
|
||||
},
|
||||
methods: {
|
||||
async getUserInfo() {
|
||||
@ -97,6 +97,10 @@ export default {
|
||||
]
|
||||
});
|
||||
},
|
||||
onRoleChange(event) {
|
||||
const role = event.data;
|
||||
this.setRoleSelection(role);
|
||||
},
|
||||
setRoleSelection(role) {
|
||||
this.role = role;
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user