diff --git a/api/router.js b/api/router.js index c5911b90..1eace6b0 100644 --- a/api/router.js +++ b/api/router.js @@ -1,6 +1,7 @@ "use strict" var Vnode = require("../render/vnode") +var Promise = require("../promise/promise") var coreRouter = require("../router/router") module.exports = function($window, redrawService) { diff --git a/docs/route.md b/docs/route.md index 234bd678..0d840b8a 100644 --- a/docs/route.md +++ b/docs/route.md @@ -384,9 +384,9 @@ For the sake of simplicity, in the example above, the user's logged in status is ### Code splitting -In a large application, it may be desirable to download the code for each route on demand, rather than upfront. Dividing the codebase this way is known as code splitting or lazy loading. In Mithril, this can be accomplished by calling the `resolve` callback of the `onmatch` hook asynchronously: +In a large application, it may be desirable to download the code for each route on demand, rather than upfront. Dividing the codebase this way is known as code splitting or lazy loading. In Mithril, this can be accomplished by returning a promise from the `onmatch` hook: -At its simplest form, one could do the following: +At its most basic form, one could do the following: ```javascript // Home.js