Skip to content

Commit

Permalink
adds GIF of reset counter in action! fixes #5 https://youtu.be/sVzvRs…
Browse files Browse the repository at this point in the history
  • Loading branch information
nelsonic committed May 8, 2017
1 parent 148a535 commit 074aa0d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,13 @@ Watch the UI tests go red in the browser:

#### 9.6 Make UI Tests Pass (_writing the minimum code_)

Luckily _both_ these tests only requires a _single_ line of code to make pass!

```js
button('Reset', signal, Res)
```
![reset-counter](https://cloud.githubusercontent.com/assets/194400/25822128/82eb7a8e-342f-11e7-9cd0-1a69d95ee878.gif)



<br /> <br />
Expand Down
3 changes: 2 additions & 1 deletion examples/counter-reset/counter.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,13 @@ function view(signal, model, root) {
empty(root); // clear root element before
return [ // Store DOM nodes in an array
button('+', signal, Inc), // then iterate to append them
div('count', model), // avoids repetition.
div('count', model), // create div with stat as text
button('-', signal, Dec), // decrement counter
button('Reset', signal, Res) // reset counter
].forEach(function(el){ root.appendChild(el) }); // forEach is ES5 so IE9+
} // yes, for loop is "faster" than forEach, but readability trumps "perf" here!


// The following are "Helper" Functions which each "Do ONLY One Thing" and are
// used in the "View" function to render the Model (State) to the Browser DOM:

Expand Down

0 comments on commit 074aa0d

Please sign in to comment.