4 ms·
There's a sample TodoMVC posted here - https://github.com/jpmonette/todomvc-mithril https://github.com/jpmonette/todomvc-mithril. If you have any idea to improv
by jpmonette 13y ago
There's a sample TodoMVC posted here - https://github.com/jpmonette/todomvc-mithril https://github.com/jpmonette/todomvc-mithril. If you have any idea to improve, feel free to send a pull request!
- thefreeman 13y agohttps://github.com/jpmonette/todomvc-mithril/blob/master/js/views/todo-view.js https://github.com/jpmonette/todomvc-mithril/blob/master/js/... Looks pretty painful, but I do think adapting JSX could be a pretty painless solution so I don't look at it as a deal breaker. I am still yet to find a javascript templating solution that I don't have at least 1 or 2 issues with.
- insin 13y agoHere's a JSXified version which assumes the existence of an "mshim" object which adapts tag calls and arguments to what m() expects: https://gist.github.com/insin/9639918 https://gist.github.com/insin/9639918
- ulisesrmzroche 13y agoHonestly, that looks worse than I thought it would. Are you guys familiar with the whole, programs are for humans to read it, and incidentally for computers to execute?
- lhorie 13y agoLooks roughly how I'd expect. Personally I don't find it unreadable, except for the 8-spaces-in-a-tab thing (which is not really relevant anyhow). Anyways, few things I see: - I'm not sure why you're doing `return m("#todo-app"), [...]` on line 15 of the view, it looks like a typo - I would probably have written a keyboard utility function similar to m.withAttr to keep the e.keyCode stuff out of the controller and remove the anonymous function in the view - I generally prefer inline ternary syntax instead of a if statement at the top for the "clear" button. - the pluralize snippet can also be pulled out into a utility method - I also tend to favor this syntax: m("input#new-todo[placeholder='What needs to be done?']") if the value of the attribute is static (line 18)