little-atom
Advanced tools
Comparing version 0.2.0 to 0.2.1
{ | ||
"name": "little-atom", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -19,21 +19,21 @@ # little-atom | ||
const actions = { | ||
increaseScore (atom, points) { | ||
const { score } = atom.get() | ||
atom.mutate({ score: score + points }) | ||
atom.checkCount() | ||
increaseScore ({ get, mutate, actions }, points) { | ||
const { score } = get() | ||
mutate({ score: score + points }) | ||
actions.checkScore() | ||
}, | ||
decreaseScore (atom, points) { | ||
const { score } = atom.get() | ||
atom.mutate({ score: score - points }) | ||
decreaseScore ({ get, mutate, actions }, points) { | ||
const { score } = get() | ||
mutate({ score: score - points }) | ||
}, | ||
checkScore (atom, payload) { | ||
const { score } = atom.get() | ||
checkScore ({ get, mutate, actions }, payload) { | ||
const { score } = get() | ||
if (score >= 1000) { | ||
console.log('You win! ...something') | ||
atom.restart() | ||
actions.restart() | ||
} | ||
}, | ||
restart (atom, payload) { | ||
restart ({ get, mutate, actions }, payload) { | ||
console.log('Restarting') | ||
atom.mutate(initialState) | ||
mutate(initialState) | ||
} | ||
@@ -48,9 +48,9 @@ } | ||
atom.increaseScore(500) | ||
atom.actions.increaseScore(500) | ||
// -> Your score is 500 | ||
atom.decreaseScore(100) | ||
atom.actions.decreaseScore(100) | ||
// -> Your score is 400 | ||
atom.increaseScore(600) | ||
atom.actions.increaseScore(600) | ||
// -> Your score is 1000 | ||
@@ -57,0 +57,0 @@ // -> You win! ...something |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
102912