bugfix(eventbus) Unwrap arrow functions and close eventbus signals
This commit is contained in:
parent
d358d89334
commit
1d8fa9d616
2 changed files with 23 additions and 9 deletions
|
|
@ -199,23 +199,35 @@ export default {
|
|||
mounted() {
|
||||
const store = useSettingsStore();
|
||||
// A global signal listener to switch tab
|
||||
eventBus.on("globalSwitchTab", (tabID) => {
|
||||
this.currentTab = tabID;
|
||||
});
|
||||
eventBus.on("globalSwitchTab", this.handleGlobalSwitchTab);
|
||||
// A global signal listener to increment tab
|
||||
eventBus.on("globalIncrementTab", () => {
|
||||
this.incrementTabBy(1);
|
||||
});
|
||||
eventBus.on("globalIncrementTab", this.handleGlobalIncrementTab);
|
||||
// A global signal listener to decrement tab
|
||||
eventBus.on("globalDecrementTab", () => {
|
||||
this.incrementTabBy(-1);
|
||||
});
|
||||
eventBus.on("globalDecrementTab", this.handleGlobalDecrementTab);
|
||||
if (store.ready) {
|
||||
this.startModals();
|
||||
}
|
||||
},
|
||||
|
||||
beforeUnmount() {
|
||||
// closing signals
|
||||
eventBus.off("globalSwitchTab", this.handleGlobalSwitchTab);
|
||||
eventBus.off("globalIncrementTab", this.handleGlobalIncrementTab);
|
||||
eventBus.off("globalDecrementTab", this.handleGlobalDecrementTab);
|
||||
},
|
||||
|
||||
methods: {
|
||||
// This methods replace the previous arrow function calls "() => {}".
|
||||
// This is needed for closing actual same opening functions.
|
||||
handleGlobalSwitchTab: function (tabID) {
|
||||
this.currentTab = tabID;
|
||||
},
|
||||
handleGlobalIncrementTab: function () {
|
||||
this.incrementTabBy(1);
|
||||
},
|
||||
handleGlobalDecrementTab: function () {
|
||||
this.incrementTabBy(-1);
|
||||
},
|
||||
setTab: function (event, tab) {
|
||||
if (!(this.currentTab == tab)) {
|
||||
this.currentTab = tab;
|
||||
|
|
|
|||
|
|
@ -109,6 +109,8 @@ export default {
|
|||
this.sizeObserver.disconnect();
|
||||
// Remove from the array of active streams
|
||||
this.store.removeStream(this.$.uid);
|
||||
// close signal
|
||||
eventBus.off("globalFlashStream", this.onFlashStream);
|
||||
},
|
||||
|
||||
methods: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue