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;
}
Vue.prototype.$browser = global.browser;
Vue.use(Vuex);
this.vuexStore = new Vuex.Store({
plugins: [VuexWebExtensions({
persistentStates: [
'uwLog',
'showLogger',
],
})],
state: {
uwLog: '',
showLogger: false,
},
mutations: {
'uw-set-log'(state, payload) {
state['uwLog'] = payload;
try {
Vue.prototype.$browser = global.browser;
Vue.use(Vuex);
this.vuexStore = new Vuex.Store({
plugins: [VuexWebExtensions({
persistentStates: [
'uwLog',
'showLogger',
'loggingEnded',
],
})],
state: {
uwLog: '',
showLogger: false,
loggingEnded: false,
},
'uw-show-logger'(state) {
state['showLogger'] = true;
mutations: {
'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) {
state['showLogger'] = false;
actions: {
'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: {
'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');
}
}
});
});
} catch (e) {
console.error("Ultrawidify failed to initialize vue. Error:", e);
}
// make sure we don't init twice
this.vueInitiated = true;