Merge branch 'bugfix/close_mitt_signals_' into 'v3'
Bugfix/close mitt signals Closes #757 See merge request openflexure/openflexure-microscope-server!581
This commit is contained in:
commit
943ebb64b2
4 changed files with 35 additions and 18 deletions
|
|
@ -199,23 +199,36 @@ 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: {
|
||||
// These methods are used for opening and closing signals.
|
||||
// They are used instead of anonymous arrow functions so we can
|
||||
// call close on the same function called with open.
|
||||
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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue