update docs, add descriptions for api methods

This commit is contained in:
Leo Horie 2016-12-02 17:51:07 -05:00
parent d56c30cc4a
commit cdb9017a72
25 changed files with 613 additions and 40 deletions

View file

@ -1,5 +1,6 @@
# mount(root, component)
- [Description](#description)
- [Signature](#signature)
- [How it works](#how-it-works)
- [Performance considerations](#performance-considerations)
@ -7,6 +8,27 @@
---
### Description
Activates a component, enabling it to autoredraw on user events
```javascript
var state = {
count: 0,
inc: function() {state.count++}
}
var Counter = {
view: function() {
return m("div", {onclick: state.inc}, state.count)
}
}
m.mount(document.body, Counter)
```
---
### Signature
`m.mount(element, component)`