Add new thing to vue store

This commit is contained in:
Tamius Han 2020-03-15 19:14:33 +01:00
parent 72a3bba8ad
commit e9795f4a00

View File

@ -123,42 +123,54 @@ class UwUi {
return; return;
} }
Vue.prototype.$browser = global.browser; try {
Vue.use(Vuex); Vue.prototype.$browser = global.browser;
this.vuexStore = new Vuex.Store({ Vue.use(Vuex);
plugins: [VuexWebExtensions({ this.vuexStore = new Vuex.Store({
persistentStates: [ plugins: [VuexWebExtensions({
'uwLog', persistentStates: [
'showLogger', 'uwLog',
], 'showLogger',
})], 'loggingEnded',
state: { ],
uwLog: '', })],
showLogger: false, state: {
}, uwLog: '',
mutations: { showLogger: false,
'uw-set-log'(state, payload) { loggingEnded: false,
state['uwLog'] = payload;
}, },
'uw-show-logger'(state) { mutations: {
state['showLogger'] = true; 'uw-set-log'(state, payload) {
state['uwLog'] = payload;
},
'uw-show-logger'(state) {
state['showLogger'] = true;
},
'uw-hide-logger'(state) {
state['showLogger'] = false;
},
'uw-logging-ended'(state) {
state['loggingEnded'] = state;
}
}, },
'uw-hide-logger'(state) { actions: {
state['showLogger'] = false; 'uw-set-log' ({commit}, payload) {
commit('uw-set-log', payload);
},
'uw-show-logger'({commit}) {
commit('uw-show-logger');
},
'uw-hide-logger'({commit}) {
commit('uw-hide-logger');
},
'uw-logging-ended'({commit}, payload) {
commit('uw-logging-ended', payload);
}
} }
}, });
actions: { } catch (e) {
'uw-set-log' ({commit}, payload) { console.error("Ultrawidify failed to initialize vue. Error:", e);
commit('uw-set-log', payload); }
},
'uw-show-logger'({commit}) {
commit('uw-show-logger');
},
'uw-hide-logger'({commit}) {
commit('uw-hide-logger');
}
}
});
// make sure we don't init twice // make sure we don't init twice
this.vueInitiated = true; this.vueInitiated = true;