diff options
author | Marco Ambrosini <marcoambrosini@pm.me> | 2020-01-08 13:45:20 +0300 |
---|---|---|
committer | Marco Ambrosini <marcoambrosini@pm.me> | 2020-01-08 17:35:09 +0300 |
commit | b6e40d0dcbb84b3a50fe87c077ab4e6f286e1468 (patch) | |
tree | 98ef5b63e8b5a9c7226c3204a4505cb45265b28e /src | |
parent | 4521c23bccb3619c538ad21ef12db32b87e84166 (diff) |
Create window visibility store
Diffstat (limited to 'src')
-rw-r--r-- | src/store/index.js | 2 | ||||
-rw-r--r-- | src/store/windowVisibilityStore.js | 58 |
2 files changed, 60 insertions, 0 deletions
diff --git a/src/store/index.js b/src/store/index.js index 53ab37cd3..dc5121559 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -29,6 +29,7 @@ import participantsStore from './participantsStore' import quoteReplyStore from './quoteReplyStore' import sidebarStore from './sidebarStore' import tokenStore from './tokenStore' +import windowVisibilityStore from './windowVisibilityStore' Vue.use(Vuex) @@ -43,6 +44,7 @@ export default new Store({ quoteReplyStore, sidebarStore, tokenStore, + windowVisibilityStore, }, mutations, diff --git a/src/store/windowVisibilityStore.js b/src/store/windowVisibilityStore.js new file mode 100644 index 000000000..ebbb41911 --- /dev/null +++ b/src/store/windowVisibilityStore.js @@ -0,0 +1,58 @@ +/** + * @copyright Copyright (c) 2019 Marco Ambrosini <marcoambrosini@pm.me> + * + * @author Marco Ambrosini <marcoambrosini@pm.me> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +const state = { + visible: true, +} + +const getters = { + windowIsVisible: (state) => () => { + return state.visible + }, +} + +const mutations = { + /** + * Sets the current visibility state + * + * @param {object} state current store state; + * @param {boolean} value the value; + */ + setVisibility(state, value) { + state.visible = value + }, +} + +const actions = { + /** + * Sets the current visibility state + * + * @param {object} context the context object; + * @param {boolean} value the value; + */ + setWindowVisibility(context, value) { + context.commit('setVisibility', value) + }, + +} + +export default { state, mutations, getters, actions } |