Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
antonmedv committed Oct 20, 2015
1 parent 4119220 commit 445ebe3
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,48 @@ npm install monkberry --save
* Extremely fast!

## Example
```html
<ToDo>
<ul>
{% for tasks %}
<li class="{{ complete ? 'stroke' : '' }}">
{{ text }}
</li>
{% endfor %}
<ul>
<div>
Total tasks {{ tasks.length }}.
</div>
</ToDo>
```

```js
import monkberry from 'monkberry';
import todo from './todo.html';

monkberry.mount(todo); // Mount template to monkberry.

var view = monkberry.render('ToDo'); // Render view with DOM tree.

document.body.appendChild(view.dom()); // Insert DOM tree on page.

view.update({
tasks: [
{
text: "Task to-do",
complete: false
},
{
text: "Another task",
complete: false
},
{
text: "This task is done",
complete: true
}
]
});
```

## Documentation

Expand Down

0 comments on commit 445ebe3

Please sign in to comment.