Fixes for example code (#433)
* Added bel, choo-persist, and choo-log to dependencies * Fixed bug in example code where deletes were not updating active/done lists correctly
This commit is contained in:
committed by
Yoshua Wuyts
parent
a5e13790c4
commit
5602bc039b
+12
-2
@@ -131,11 +131,21 @@ function todoStore (state, emitter) {
|
||||
|
||||
if (todo.done) {
|
||||
var done = state.todos.done
|
||||
var doneIndex = done[todo]
|
||||
var doneIndex
|
||||
done.forEach(function (_todo, j) {
|
||||
if (_todo.id === id) {
|
||||
doneIndex = j
|
||||
}
|
||||
})
|
||||
done.splice(doneIndex, 1)
|
||||
} else {
|
||||
var active = state.todos.active
|
||||
var activeIndex = active[todo]
|
||||
var activeIndex
|
||||
active.forEach(function (_todo, j) {
|
||||
if (_todo.id === id) {
|
||||
activeIndex = j
|
||||
}
|
||||
})
|
||||
active.splice(activeIndex, 1)
|
||||
}
|
||||
emitter.emit('render')
|
||||
|
||||
@@ -9,7 +9,10 @@
|
||||
"test": "standard && npm run deps && node test.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"bel": "^4.5.1",
|
||||
"choo-expose": "^1.0.0",
|
||||
"choo-log": "^5.0.0",
|
||||
"choo-persist": "^3.0.0",
|
||||
"sheetify": "^6.0.1",
|
||||
"todomvc-app-css": "^2.0.6",
|
||||
"todomvc-common": "^1.0.3",
|
||||
|
||||
Reference in New Issue
Block a user