Skip to content

Commit d983668

Browse files
committed
updated to choo4
1 parent 008eb27 commit d983668

File tree

6 files changed

+38
-58
lines changed

6 files changed

+38
-58
lines changed

_app/_package.json

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,23 @@
11
{
22
"name": "<%= projectName %>",
3-
"version": "0.0.0",
3+
"version": "1.0.0",
44
"description": "Created with choo-cli",
5-
"license": "MIT",
5+
"main": "client.js",
66
"scripts": {
7-
"build:prod": "scripts/build-prod.sh",
8-
"start": "budo ./client.js --live --pushstate --open -- -g es2040",
7+
"start": "bankai client.js -p 8080 --open",
8+
"build:prod": "bankai build client.js dist/",
99
"lint": "standard --verbose | snazzy",
1010
"test": "npm run lint"
1111
},
12+
"keywords": [],
13+
"author": "",
14+
"license": "MIT",
1215
"dependencies": {
13-
"choo": "^3.2.0"
16+
"choo": "^4.1.0"
1417
},
1518
"devDependencies": {
16-
"browserify": "^13.0.1",
17-
"budo": "8.3.0",
18-
"es2040": "1.2.2",
19-
"envify": "^3.4.1",
20-
"standard": "^7.1.2",
21-
"snazzy": "^4.0.0",
22-
"uglifyify": "^3.0.2",
23-
"unassertify": "^2.0.3",
24-
"yo-yoify": "^3.3.0"
25-
},
26-
"standard": {
27-
"ignore": [
28-
"scripts"
29-
]
19+
"bankai": "^5.3.0",
20+
"snazzy": "^6.0.0",
21+
"standard": "^8.6.0"
3022
}
3123
}

_app/models/app.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@ module.exports = {
55
},
66
reducers: {
77
/* synchronous operations that modify state. Triggered by actions. Signature of (data, state). */
8-
update: (data, state) => ({ title: data.value })
8+
update: function (state, data) {
9+
return { title: data.value }
10+
}
911
},
1012
effects: {
1113
// asynchronous operations that don't modify state directly.
1214
// Triggered by actions, can call actions. Signature of (data, state, send, done)
1315
/*
14-
myEffect: (data, state, send, done) => {
16+
myEffect: function (state, data, send, done) {
1517
// do stuff
1618
}
1719
*/
@@ -20,8 +22,12 @@ module.exports = {
2022
// asynchronous read-only operations that don't modify state directly.
2123
// Can call actions. Signature of (send, done).
2224
/*
23-
(send, done) => {
24-
// do stuff
25+
checkStuff: function (send, done) {
26+
setInterval(function () {
27+
send('<%= name %>:update, data, function (err) {
28+
if (err) return done(err)
29+
})
30+
}, 1000)
2531
}
2632
*/
2733
}

_app/pages/home.js

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
const html = require('choo/html')
22

3-
module.exports = (state, prev, send) => html`
4-
<main>
5-
<h1>Hello, World!</h1>
6-
<p>If you are seeing this, then the generator works!</p>
7-
<h2>Demo</h2>
8-
<h3>${state.title}</h3>
9-
<input
10-
type="text"
11-
oninput=${(e) => send('update', { value: e.target.value })} />
12-
</main>
13-
`
3+
module.exports = function (state, prev, send) {
4+
return html`
5+
<main>
6+
<h1>Hello, World!</h1>
7+
<p>If you are seeing this, then the generator works!</p>
8+
<h2>Demo</h2>
9+
<h3>${state.title}</h3>
10+
<input type="text" oninput=${update} />
11+
</main>
12+
`
13+
14+
function update(e) {
15+
send('update', e.target.value)
16+
}
17+
}

_app/scripts/README.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

_app/scripts/build-prod.sh

Lines changed: 0 additions & 17 deletions
This file was deleted.

_generators/model.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ const <%= name %> = {
66
},
77
reducers: {
88
/* synchronous operations that modify state. Triggered by actions. Signature of (data, state). */
9-
// update: function (state, data) => {
9+
// update: function (state, data) {
1010
// return { title: data.value }
1111
// }
1212
},
1313
effects: {
1414
// asynchronous operations that don't modify state directly.
1515
// Triggered by actions, can call actions. Signature of (data, state, send, done)
1616
/*
17-
myEffect: function (state, data, send, done) => {
17+
myEffect: function (state, data, send, done) {
1818
// do stuff
1919
}
2020
*/

0 commit comments

Comments
 (0)