Skip to content

Commit aac9f87

Browse files
committed
Update readme
1 parent 3bcb9a5 commit aac9f87

1 file changed

Lines changed: 61 additions & 1 deletion

File tree

README.md

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,62 @@
11
# hyperapp-devtools
2-
Developer tools for Hyperapp projects.
2+
3+
Developer tools for Hyperapp projects.
4+
These tools have been extracted from [hyperstart's](https://hyperstart.io) debugger.
5+
6+
This is an higher order application (HOA) that records every action and allow the user to see input argument, output and state at every step.
7+
8+
See it in action here:
9+
10+
![debugger in action](https://user-images.githubusercontent.com/8634093/38358639-1c1a3ccc-38c6-11e8-89c0-c05df861eda4.gif)
11+
12+
## Installation
13+
14+
Install it from npm:
15+
16+
```
17+
npm install hyperapp-debug --save-dev
18+
```
19+
20+
Or get it directly from unpkg:
21+
22+
```html
23+
<script src="https://unpkg.com/hyperapp-devtools"></script>
24+
```
25+
26+
## Usage
27+
28+
Just wrap your hyperapp:
29+
30+
```js
31+
import { h, app } from "hyperapp"
32+
import devtools from "hyperapp-devtools"
33+
34+
const state = {
35+
count: 0
36+
}
37+
38+
const actions = {
39+
down: value => state => ({ count: state.count - value }),
40+
up: value => state => ({ count: state.count + value })
41+
}
42+
43+
const view = (state, actions) => (
44+
<div>
45+
<h1>{state.count}</h1>
46+
<button onclick={() => actions.down(1)}>-</button>
47+
<button onclick={() => actions.up(1)}>+</button>
48+
</div>
49+
)
50+
51+
devtools(app)(state, actions, view, document.body)
52+
```
53+
54+
## Possible improvements
55+
56+
* set the app state when time traveling
57+
* edit the app state
58+
* trigger actions
59+
60+
## License
61+
62+
MIT

0 commit comments

Comments
 (0)