"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:
pskfyi 2022-01-06 14:28:23 -08:00 committed by pskfyi
commit 225d7e3c09
5 changed files with 94 additions and 32 deletions

24
store/incremental.js Normal file
View 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
}
}