create-app
Advanced tools
Comparing version 0.1.4 to 0.1.5
@@ -9,2 +9,4 @@ 'use strict'; | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; /** | ||
@@ -63,7 +65,12 @@ * createApp at server | ||
function render(requestPath, callback) { | ||
function render(requestPath, injectContext, callback) { | ||
var result = null; | ||
if (typeof injectContext === 'function') { | ||
callback = injectContext; | ||
injectContext = null; | ||
} | ||
try { | ||
result = initController(fetchController(requestPath)); | ||
result = initController(fetchController(requestPath, injectContext)); | ||
} catch (error) { | ||
@@ -101,3 +108,3 @@ callback && callback(error); | ||
function fetchController(requestPath) { | ||
function fetchController(requestPath, injectContext) { | ||
var location = history.createLocation(requestPath); | ||
@@ -131,6 +138,8 @@ var matches = matcher(location.pathname); | ||
var finalContext = _extends({}, context, injectContext); | ||
if (_.isThenable(Controller)) { | ||
return Controller.then(function (Controller) { | ||
var Wrapper = wrapController(location.pattern, Controller); | ||
return new Wrapper(location, context); | ||
return new Wrapper(location, finalContext); | ||
}); | ||
@@ -140,3 +149,3 @@ } | ||
var Wrapper = wrapController(location.pattern, Controller); | ||
return new Wrapper(location, context); | ||
return new Wrapper(location, finalContext); | ||
} | ||
@@ -143,0 +152,0 @@ |
{ | ||
"name": "create-app", | ||
"version": "0.1.4", | ||
"version": "0.1.5", | ||
"description": "configuring once, rendering both client and server.", | ||
@@ -5,0 +5,0 @@ "browser": "lib/client/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
32884
708