architecture: use barracks

Changes
=======
- add hook handlers
- add effect composition
- add noFreeze option

Commits
=======
- fixup! fix toString()
- fixup! use assert instead of throw
- fixup! fix reducers
- fixup! work on done callbacks
- fixup! more callback work
- fixup! woooh fixed effects errs
- fixup! wrap up stuff
This commit is contained in:
Yoshua Wuyts
2016-07-02 16:00:26 +02:00
parent 8f8df602c5
commit 9e039ed561
10 changed files with 146 additions and 218 deletions
+20 -1
View File
@@ -2,7 +2,26 @@ const choo = require('../../')
const mainView = require('./views/main')
const app = choo()
const app = choo({
onError: function (err, state, createSend) {
console.groupCollapsed(`Error: ${err.message}`)
console.error(err)
console.groupEnd()
const send = createSend('onError: ')
send('app:error', err)
},
onAction: function (action, state, name, caller, createSend) {
console.groupCollapsed(`Action: ${caller} -> ${name}`)
console.log(action)
console.groupEnd()
},
onState: function (action, state, prev, createSend) {
console.groupCollapsed('State')
console.log(prev)
console.log(state)
console.groupEnd()
}
})
app.model(require('./models/error'))
app.model(require('./models/api'))