Archived
2
0
This repository has been archived on 2024-06-24. You can view files and clone it, but cannot push or open issues or pull requests.
neko-custom/client/src/store/settings.ts

44 lines
1.0 KiB
TypeScript
Raw Normal View History

2020-01-24 04:23:26 +13:00
import { getterTree, mutationTree } from 'typed-vuex'
import { get, set } from '~/utils/localstorage'
2020-01-23 06:16:40 +13:00
export const namespaced = true
2020-01-24 04:23:26 +13:00
export const state = () => {
return {
scroll: get<number>('scroll', 10),
scroll_invert: get<boolean>('scroll_invert', true),
autoplay: get<boolean>('autoplay', true),
ignore_emotes: get<boolean>('ignore_emotes', false),
chat_sound: get<boolean>('chat_sound', true),
}
}
2020-01-23 06:16:40 +13:00
export const getters = getterTree(state, {})
export const mutations = mutationTree(state, {
setScroll(state, scroll: number) {
state.scroll = scroll
2020-01-24 04:23:26 +13:00
set('scroll', scroll)
2020-01-23 06:16:40 +13:00
},
2020-01-24 04:23:26 +13:00
setInvert(state, value: boolean) {
state.scroll_invert = value
set('scroll_invert', value)
2020-01-23 06:16:40 +13:00
},
2020-01-24 04:23:26 +13:00
setAutoplay(state, value: boolean) {
state.autoplay = value
set('autoplay', value)
},
setIgnore(state, value: boolean) {
state.ignore_emotes = value
set('ignore_emotes', value)
},
setSound(state, value: boolean) {
state.chat_sound = value
set('chat_sound', value)
},
})