VNDB fork of mithril.js
It seems this condition is put here to reassure users that redrawing in a given route state will not draw the views of components for other routes, but it's difficult to imagine how somebody might worry that might happen. As it is, people end up believing that redraw acts per-component, which is highly misleading in a situation where there are nested components or multiple mount points, and the call to redraw is invoked within one of those components. |
||
|---|---|---|
| archive | ||
| bench | ||
| deploy | ||
| docs | ||
| test | ||
| test-deps | ||
| tests | ||
| .editorconfig | ||
| .eslintignore | ||
| .eslintrc | ||
| .gitattributes | ||
| .gitignore | ||
| .npmignore | ||
| .travis.yml | ||
| CONTRIBUTING.md | ||
| Gruntfile.js | ||
| LICENSE | ||
| mithril.closure-compiler-externs.js | ||
| mithril.d.ts | ||
| mithril.js | ||
| mithril.min.js | ||
| mithril.min.js.map | ||
| package.json | ||
| README.md | ||
Mithril
A Javascript Framework for Building Brilliant Applications
See the website for documentation
There's also a blog and a mailing list
What is Mithril?
Mithril is a client-side MVC framework - a tool to organize code in a way that is easy to think about and to maintain.
Light-weight
- Only 7.8 kB gzipped, no dependencies
- Small API, small learning curve
Robust
- Safe-by-default templates
- Hierarchical MVC via components
Fast
- Virtual DOM diffing and compilable templates
- Intelligent auto-redrawing system
Sample code
//namespace
var app = {};
//model
app.PageList = function() {
return m.request({method: "GET", url: "pages.json"});
};
//controller
app.controller = function() {
var pages = app.PageList();
return {
pages: pages,
rotate: function() {
pages().push(pages().shift());
}
}
};
//view
app.view = function(ctrl) {
return [
ctrl.pages().map(function(page) {
return m("a", {href: page.url}, page.title);
}),
m("button", {onclick: ctrl.rotate}, "Rotate links")
];
};
//initialize
m.mount(document.getElementById("example"), app);