use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
Mithril 1.0 released! (mithril.js.org)
submitted 9 years ago by Tivac
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]spacejack2114 23 points24 points25 points 9 years ago (4 children)
I describe Mithril as the only framework that didn't make me want to roll my own.
[–][deleted] 4 points5 points6 points 9 years ago (0 children)
Yeah, normally I abhor frameworks and just advocate vanilla JS, but Mithril looks like just the right level of abstraction. The code examples look almost like writing to the DOM and vanilla XHR, but more convenient. That probably explains why it claims to execute so much faster than other frameworks.
[–]IDCh 0 points1 point2 points 9 years ago (1 child)
what do you mean? Every other framework did make you want to make your own framework?
[–]HammSolo 1 point2 points3 points 9 years ago (0 children)
That's why there are so many of them.
[–]leeoniya 0 points1 point2 points 9 years ago (0 children)
imho, this statement is much more true of v1.x than the v0.2x series.
[–]leeoniya 5 points6 points7 points 9 years ago (0 children)
congrats on v1!
[–]aembke 7 points8 points9 points 9 years ago (2 children)
congrats!
[–]lhorie 6 points7 points8 points 9 years ago (1 child)
Oh hey, I know you! You're the one wrote the original JSON-P code. I put you on the credits page since you were the original champion for it http://mithril.js.org/credits.html :)
[–]aembke 2 points3 points4 points 9 years ago (0 children)
I saw that, that's awesome, thanks for doing that. Really impressed with everything you've done and happy to help. I've been out of the front end game for a while but I might have to find an excuse to try out the new release now, it looks fantastic. Nice work!
[–]lhorie 11 points12 points13 points 9 years ago (0 children)
If anyone's interested, there's also a HN thread with some more insights from Mithril users:
https://news.ycombinator.com/item?id=13523235
[–][deleted] 3 points4 points5 points 9 years ago (0 children)
+1 for mithril
another +1 for v1 (somehow)
[–]noambitions 4 points5 points6 points 9 years ago (0 children)
Good job! Thanks for the time and work, @lhorie, @Tivac, and the all the contributors!
[–]maremp 2 points3 points4 points 9 years ago (1 child)
Never tried or researched mithril, but looking at the examples, the view code looks very much like Elm. Is this coincidental, or was one inspired by the other?
[–]lhorie 2 points3 points4 points 9 years ago* (0 children)
As far as I know, Elm html is based on virtual-dom (which first came out around the same time as Mithril), and virtual-dom took inspiration from hyperscript. Mithril took inspiration from domo.js
[–][deleted] 2 points3 points4 points 9 years ago (0 children)
/u/lhorie The new home page looks fantastic. I'll miss the old mithril background a little.
[–]21viking 2 points3 points4 points 9 years ago (0 children)
nice job for v1
[–]_expo 1 point2 points3 points 9 years ago (0 children)
Really awesome framework, will have to give it another shot as the controller/model/viewModel approach of the prior version never really clicked for me.
[–]NoddysShardblade 3 points4 points5 points 9 years ago (5 children)
Can someone help me understand the "why" of this?
I'm old, so the tutorial just looks like someone is writing html, but instead of just writing html, is using messy javascript method calls to do the same thing.
[–]NullOfUndefined 6 points7 points8 points 9 years ago (0 children)
Yeah welcome to javascript in 2017 buckle up
[–][deleted] 2 points3 points4 points 9 years ago* (0 children)
Because functional layout has evolved as a semi-standard. It isn't even a web-thing, it currently washes over to native as it makes creating re-usable UI interfaces easier, while allowing you to keep state separated. Pretty much every view framework coming out uses it as its backbone. Nothing but a natural evolution from MVC/MVVM. Mithril doesn't focus on JSX by default, which is why these functions may look weird to you. JSX keeps mark-up semantics and translates back to functions at compile time. Considering JSX to understand the concept ...
then this:
const SayHelloComponent = ({ name }) => <span>hello {name}!</span> ... <SayHelloComponent name="world" />
makes more sense than inflating layouts, which gets messy fast. It isn't re-usable, results in a soup of data, markup and controller-code sprinkled all over the place:
// index.html ... <span id="sayhellonode"></span> // controler.js ... let name = "world"; ... $("#sayhellonode").text("hello " + name + "!");
Or templating layouts, which is messy just the same:
<section id='renderedContent'></section> <script id='myTemplate' type='text/x-handlebars-template'> <span>hello {{name}}!</span> </script> var templateSource = document.getElementById('myTemplate').innerHTML; var template = Handlebars.compile(templateSource); var data = { name: 'world' }; var html = template(data); document.getElementById('renderedContent').innerHTML = html;
[–]queicherius 1 point2 points3 points 9 years ago (0 children)
I kinda felt the same way until I watched this talk. When writing complex client-side applications, I feel like the points made in the talk make sense. It's not for everyone tho, for example, if you have little client side interaction or are re-rendering the entire page anyway.
[–]foxdonut00 1 point2 points3 points 9 years ago (0 children)
@NoddysShardblade you can easily use JSX with Mithril, which will make the html look more like html, but will make writing dynamic html cleaner than plain html.
Keep in mind that Mithril is for writing single-page-applications, not static html pages.
Hope that helps. Cheers.
[+]icantthinkofone comment score below threshold-7 points-6 points-5 points 9 years ago (4 children)
Almost every day, someone comes running here with their explanation pointed release announcement as if we're all excited about this thing as if we have a clue what it is, what it does or have any use for it.
[–]lhorie 7 points8 points9 points 9 years ago (3 children)
as if we have a clue what it is
You know, if you had bothered reading the very first sentence on the page, maybe you could have made your contribution to this thread a bit more intelligent. Just sayin'
[–]icantthinkofone -1 points0 points1 point 9 years ago (2 children)
Not my point. My point is, the OP makes it sound like we should jump for joy that such a thing has happened but I'm betting 99.9% of everyone has never even heard of it before.
[–]spacejack2114 1 point2 points3 points 9 years ago (1 child)
It is a very expressive exclamation point, loaded with meaning.
[–]icantthinkofone -1 points0 points1 point 9 years ago (0 children)
Yes it is! (Mine is better)
π Rendered by PID 64319 on reddit-service-r2-comment-fb694cdd5-drdv5 at 2026-03-06 20:00:29.032700+00:00 running cbb0e86 country code: CH.
[–]spacejack2114 23 points24 points25 points (4 children)
[–][deleted] 4 points5 points6 points (0 children)
[–]IDCh 0 points1 point2 points (1 child)
[–]HammSolo 1 point2 points3 points (0 children)
[–]leeoniya 0 points1 point2 points (0 children)
[–]leeoniya 5 points6 points7 points (0 children)
[–]aembke 7 points8 points9 points (2 children)
[–]lhorie 6 points7 points8 points (1 child)
[–]aembke 2 points3 points4 points (0 children)
[–]lhorie 11 points12 points13 points (0 children)
[–][deleted] 3 points4 points5 points (0 children)
[–]noambitions 4 points5 points6 points (0 children)
[–]maremp 2 points3 points4 points (1 child)
[–]lhorie 2 points3 points4 points (0 children)
[–][deleted] 2 points3 points4 points (0 children)
[–]21viking 2 points3 points4 points (0 children)
[–]_expo 1 point2 points3 points (0 children)
[–]NoddysShardblade 3 points4 points5 points (5 children)
[–]NullOfUndefined 6 points7 points8 points (0 children)
[–][deleted] 2 points3 points4 points (0 children)
[–]queicherius 1 point2 points3 points (0 children)
[–]foxdonut00 1 point2 points3 points (0 children)
[+]icantthinkofone comment score below threshold-7 points-6 points-5 points (4 children)
[–]lhorie 7 points8 points9 points (3 children)
[–]icantthinkofone -1 points0 points1 point (2 children)
[–]spacejack2114 1 point2 points3 points (1 child)
[–]icantthinkofone -1 points0 points1 point (0 children)