VNDB fork of mithril.js
Find a file
Isiah Meadows 9288a915a4 Merge pull request #1121 from barneycarroll/patch-3
Long-term Node fans might take exception (lol)...
2016-06-22 14:22:58 -04:00
api Add editorconfig, resolve differences 2016-06-18 03:22:12 -04:00
bundler lint docs 2016-06-20 23:35:43 -04:00
docs Merge pull request #1121 from barneycarroll/patch-3 2016-06-22 14:22:58 -04:00
examples Remove the injection of Stream into requestService 2016-06-20 18:37:17 +02:00
module Quiet some ESLint errors (#1060) 2016-05-19 22:18:31 -07:00
ospec Merge remote-tracking branch 'origin/rewrite' into rewrite 2016-06-20 09:34:14 -04:00
promise Add editorconfig, resolve differences 2016-06-18 03:22:12 -04:00
querystring Add editorconfig, resolve differences 2016-06-18 03:22:12 -04:00
render Add editorconfig, resolve differences 2016-06-18 03:22:12 -04:00
request Merge remote-tracking branch 'origin/rewrite' into rewrite 2016-06-20 09:34:14 -04:00
router Add editorconfig, resolve differences 2016-06-18 03:22:12 -04:00
test-utils Add editorconfig, resolve differences 2016-06-18 03:22:12 -04:00
util ensure upstream does not affect ended stream 2016-06-20 22:25:43 -04:00
.editorconfig Add editorconfig, resolve differences 2016-06-18 03:22:12 -04:00
.eslintignore Add ESLint and a generated config/ignore file 2016-05-19 12:37:33 -07:00
.eslintrc.js Add editorconfig, resolve differences 2016-06-18 03:22:12 -04:00
.gitignore Quiet some ESLint errors (#1060) 2016-05-19 22:18:31 -07:00
.travis.yml Add editorconfig, resolve differences 2016-06-18 03:22:12 -04:00
CONTRIBUTING.md Add editorconfig, resolve differences 2016-06-18 03:22:12 -04:00
index.js Merge remote-tracking branch 'origin/rewrite' into rewrite 2016-06-20 09:34:14 -04:00
mithril.js rebuild 2016-06-20 23:08:27 -04:00
package.json lintdocs and minify scripts 2016-06-20 09:19:30 -04:00
README.md update docs 2016-06-20 09:22:00 -04:00

Mithril.js - A framework for building brilliant applications

Note: This branch is a sneak peek for the upcoming version 1.0. It's a rewrite from the ground up and it's not backwards compatible with Mithril 0.2.x

This rewrite aims to fix longstanding API design issues, significantly improve performance, and clean up the codebase.

Early Preview

You can install this via NPM using this command:

npm install lhorie/mithril.js#rewrite

Examples run out of the box. Just open the HTML files.

Status

Code still is in flux. Most notably, there's no promise polyfill yet and there are several use cases that still need to be polished. DO NOT USE IN PRODUCTION YET!

Some examples of usage can be found in the examples folder. ThreadItJS has the largest API surface coverage and comments indicating pending issues in framework usability. Note that the APIs those examples use may not become the final public API points in v1.0.

Partial documentation can be found in the /docs directory

Performance

Mithril's virtual DOM engine is less than 500 lines of well organized code and it implements a modern search space reduction diff algorithm and a DOM recycling mechanism, which translate to top-of-class performance. See the dbmon implementation (non-optimized) (for comparison, here are optimized dbmon implementations for React v15.0.2, Angular v2.0.0-beta.17 and Mithril 0.2.x).

Lifecycle methods and Animation Support

Mithril's config method is now replaced by several lifecycle methods to improve separation of concerns and allow better control over animations.

  • oninit(vnode) Runs once before vnode diff and creation
  • oncreate(vnode) Runs once after the DOM element is created. It's guaranteed to run after all DOM changes in the render cycle
  • onupdate(vnode) Runs after vnode is diffed by a re-render. It's guaranteed to run after all DOM changes in the render cycle
  • onbeforeremove(vnode, done) Runs before DOM removal and waits for done to be called before actually removing the DOM element. Affects when onremove is called
  • onremove(vnode) Runs after DOM removal.

Robustness

There are over 2600 assertions in the test suite, and tests cover even difficult-to-test things like location.href, element.innerHTML and XMLHttpRequest usage.

Modularity

Despite the huge performance improvements, the new codebase is smaller than v0.2.x, currently clocking at 6.7kb min+gzip

In addition, Mithril is now completely modular: you can import only the modules that you need and easily integrate 3rd party modules if you wish to use a different library for routing, ajax, and even rendering