"incremental.js" vuex store for shared state. See InfinityTester component for examples on how to modify the store; arbitarily many currencies can be controlled.
This commit is contained in:
parent
cc65639b75
commit
225d7e3c09
5 changed files with 94 additions and 32 deletions
24
store/incremental.js
Normal file
24
store/incremental.js
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import Decimal from "break_infinity.js"
|
||||
|
||||
export const state = () => ({
|
||||
currency: {
|
||||
energy: new Decimal(0),
|
||||
// if it hasn't been your
|
||||
days: new Decimal(0),
|
||||
weeks: new Decimal(0),
|
||||
months: new Decimal(0),
|
||||
// or even your
|
||||
years: new Decimal(0)
|
||||
}
|
||||
})
|
||||
|
||||
export const mutations = {
|
||||
add(state, { key, value }) {
|
||||
state.currency[key] = Decimal.add(state.currency[key], value)
|
||||
},
|
||||
|
||||
set(state, { key, value }) {
|
||||
state.currency[key] = value
|
||||
}
|
||||
}
|
||||
|
||||
Reference in a new issue