doc tweaks

This commit is contained in:
Leo Horie 2014-11-12 20:06:24 -05:00
parent 515ba7cf9c
commit 5ed8891db3
6 changed files with 94 additions and 25 deletions

View file

@ -44,11 +44,13 @@ app.PageList = function() {
//controller
app.controller = function() {
this.pages = app.PageList();
this.rotate = function() {
this.pages().push(this.pages().shift())
}.bind(this)
var pages = app.PageList();
return {
pages: pages,
rotate: function() {
pages().push(pages().shift());
}
}
};
//view
@ -57,10 +59,11 @@ app.view = function(ctrl) {
ctrl.pages().map(function(page) {
return m("a", {href: page.url}, page.title);
}),
m("a", {onclick: ctrl.rotate}, "Rotate links")
m("button", {onclick: ctrl.rotate}, "Rotate links")
];
};
//initialize
m.module(document.getElementById("example"), app);
```
@ -70,5 +73,5 @@ m.module(document.getElementById("example"), app);
### Learn more
- [Tutorial](http://lhorie.github.io/mithril/getting-started.html)
- [Differences from Other MVC Frameworks](http://lhorie.github.io/mithril/comparison.html)
- [Differences from Other Frameworks](http://lhorie.github.io/mithril/comparison.html)
- [Benchmarks](http://lhorie.github.io/mithril/benchmarks.html)