From 624c0d5fa12cbefbaf9cc943c74fc99dd35c8071 Mon Sep 17 00:00:00 2001 From: Gandalf-the-Bot Date: Mon, 5 Dec 2016 17:33:12 +0000 Subject: [PATCH] Bundled output for commit 9f340daa3a7ae1ad557c6ec1bc0a1f6120765fab [skip ci] --- README.md | 2 +- mithril.js | 29 +++++++++++++++-------------- mithril.min.js | 9 +++++---- 3 files changed, 21 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 4676e66b..5adbc680 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,6 @@ There are over 4000 assertions in the test suite, and tests cover even difficult ## Modularity -Despite the huge improvements in performance and modularity, the new codebase is smaller than v0.2.x, currently clocking at 7.40 KB min+gzip +Despite the huge improvements in performance and modularity, the new codebase is smaller than v0.2.x, currently clocking at 7.42 KB 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 diff --git a/mithril.js b/mithril.js index b214a003..03017df3 100644 --- a/mithril.js +++ b/mithril.js @@ -1092,31 +1092,32 @@ var _20 = function($window, redrawService0) { var routeService = coreRouter($window) var identity = function(v) {return v} - var currentResolver, currentComponent, currentParams, currentPath, currentResolve + var resolver, component, attrs3, currentPath, resolve var route = function(root, defaultRoute, routes) { - var update = function(resolver, component, params, path) { - currentResolver = resolver, currentComponent = component, currentParams = params, currentPath = path, currentResolve = null - currentResolver.render = resolver.render || identity + if (root == null) throw new Error("Ensure the DOM element that was passed to `m.route` is not undefined") + var update = function(routeResolver, comp, params, path) { + resolver = routeResolver, component = comp, attrs3 = params, currentPath = path, resolve = null + resolver.render = routeResolver.render || identity render1() } var render1 = function() { - if (currentResolver != null) redrawService0.render(root, currentResolver.render(Vnode(currentComponent, currentParams.key, currentParams))) + if (resolver != null) redrawService0.render(root, resolver.render(Vnode(component, attrs3.key, attrs3))) } - routeService.defineRoutes(routes, function(component, params, path) { - if (component.view) update({}, component, params, path) + routeService.defineRoutes(routes, function(payload, params, path) { + if (payload.view) update({}, payload, params, path) else { - if (component.onmatch) { - if (currentResolve != null) update(component, currentComponent, params, path) + if (payload.onmatch) { + if (resolve != null) update(payload, component, params, path) else { - currentResolve = function(resolved) { - update(component, resolved, params, path) + resolve = function(resolved) { + update(payload, resolved, params, path) } - component.onmatch(function(resolved) { - if (currentResolve != null) currentResolve(resolved) + payload.onmatch(function(resolved) { + if (resolve != null) resolve(resolved) }, params, path) } } - else update(component, "div", params, path) + else update(payload, "div", params, path) } }, function() { routeService.setPath(defaultRoute) diff --git a/mithril.min.js b/mithril.min.js index 1a81dc22..c64fe7e3 100644 --- a/mithril.min.js +++ b/mithril.min.js @@ -33,8 +33,9 @@ function J(a,b,c){"function"===typeof a.oninit&&a.oninit.call(b.state,b);"functi null==a.vnodes&&(a.textContent="");b instanceof Array||(b=[b]);g(a,a.vnodes,r.normalizeChildren(b),c,null,void 0);a.vnodes=b;for(var e=0;e