-
-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
21897ec
commit b0948de
Showing
9 changed files
with
374 additions
and
214 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,76 @@ | ||
define(["exports", "aurelia-templating", "aurelia-router", "aurelia-path", "aurelia-metadata"], function (exports, _aureliaTemplating, _aureliaRouter, _aureliaPath, _aureliaMetadata) { | ||
"use strict"; | ||
|
||
var _inherits = function (child, parent) { | ||
if (typeof parent !== "function" && parent !== null) { | ||
throw new TypeError("Super expression must either be null or a function, not " + typeof parent); | ||
var _prototypeProperties = function (child, staticProps, instanceProps) { | ||
if (staticProps) Object.defineProperties(child, staticProps); | ||
if (instanceProps) Object.defineProperties(child.prototype, instanceProps); | ||
}; | ||
|
||
var _inherits = function (subClass, superClass) { | ||
if (typeof superClass !== "function" && superClass !== null) { | ||
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); | ||
} | ||
child.prototype = Object.create(parent && parent.prototype, { | ||
subClass.prototype = Object.create(superClass && superClass.prototype, { | ||
constructor: { | ||
value: child, | ||
value: subClass, | ||
enumerable: false, | ||
writable: true, | ||
configurable: true | ||
} | ||
}); | ||
if (parent) child.__proto__ = parent; | ||
if (superClass) subClass.__proto__ = superClass; | ||
}; | ||
|
||
var CompositionEngine = _aureliaTemplating.CompositionEngine; | ||
var RouteLoader = _aureliaRouter.RouteLoader; | ||
var Router = _aureliaRouter.Router; | ||
var relativeToFile = _aureliaPath.relativeToFile; | ||
var Origin = _aureliaMetadata.Origin; | ||
var TemplatingRouteLoader = (function () { | ||
var _RouteLoader = RouteLoader; | ||
var TemplatingRouteLoader = function TemplatingRouteLoader(compositionEngine) { | ||
var TemplatingRouteLoader = (function (RouteLoader) { | ||
function TemplatingRouteLoader(compositionEngine) { | ||
this.compositionEngine = compositionEngine; | ||
}; | ||
|
||
_inherits(TemplatingRouteLoader, _RouteLoader); | ||
} | ||
|
||
TemplatingRouteLoader.inject = function () { | ||
return [CompositionEngine]; | ||
}; | ||
_inherits(TemplatingRouteLoader, RouteLoader); | ||
|
||
TemplatingRouteLoader.prototype.loadRoute = function (router, config) { | ||
var childContainer = router.container.createChild(), instruction = { | ||
viewModel: relativeToFile(config.moduleId, Origin.get(router.container.viewModel.constructor).moduleId), | ||
childContainer: childContainer, | ||
view: config.view | ||
}, childRouter; | ||
_prototypeProperties(TemplatingRouteLoader, { | ||
inject: { | ||
value: function () { | ||
return [CompositionEngine]; | ||
}, | ||
writable: true, | ||
enumerable: true, | ||
configurable: true | ||
} | ||
}, { | ||
loadRoute: { | ||
value: function (router, config) { | ||
var childContainer = router.container.createChild(), | ||
instruction = { | ||
viewModel: relativeToFile(config.moduleId, Origin.get(router.container.viewModel.constructor).moduleId), | ||
childContainer: childContainer, | ||
view: config.view | ||
}, | ||
childRouter; | ||
|
||
childContainer.registerHandler(Router, function (c) { | ||
return childRouter || (childRouter = router.createChild(childContainer)); | ||
}); | ||
childContainer.registerHandler(Router, function (c) { | ||
return childRouter || (childRouter = router.createChild(childContainer)); | ||
}); | ||
|
||
return this.compositionEngine.createViewModel(instruction).then(function (instruction) { | ||
instruction.executionContext = instruction.viewModel; | ||
instruction.router = router; | ||
return instruction; | ||
}); | ||
}; | ||
return this.compositionEngine.createViewModel(instruction).then(function (instruction) { | ||
instruction.executionContext = instruction.viewModel; | ||
instruction.router = router; | ||
return instruction; | ||
}); | ||
}, | ||
writable: true, | ||
enumerable: true, | ||
configurable: true | ||
} | ||
}); | ||
|
||
return TemplatingRouteLoader; | ||
})(); | ||
})(RouteLoader); | ||
|
||
exports.TemplatingRouteLoader = TemplatingRouteLoader; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,74 @@ | ||
"use strict"; | ||
|
||
var _inherits = function (child, parent) { | ||
if (typeof parent !== "function" && parent !== null) { | ||
throw new TypeError("Super expression must either be null or a function, not " + typeof parent); | ||
var _prototypeProperties = function (child, staticProps, instanceProps) { | ||
if (staticProps) Object.defineProperties(child, staticProps); | ||
if (instanceProps) Object.defineProperties(child.prototype, instanceProps); | ||
}; | ||
|
||
var _inherits = function (subClass, superClass) { | ||
if (typeof superClass !== "function" && superClass !== null) { | ||
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); | ||
} | ||
child.prototype = Object.create(parent && parent.prototype, { | ||
subClass.prototype = Object.create(superClass && superClass.prototype, { | ||
constructor: { | ||
value: child, | ||
value: subClass, | ||
enumerable: false, | ||
writable: true, | ||
configurable: true | ||
} | ||
}); | ||
if (parent) child.__proto__ = parent; | ||
if (superClass) subClass.__proto__ = superClass; | ||
}; | ||
|
||
var CompositionEngine = require("aurelia-templating").CompositionEngine; | ||
var RouteLoader = require("aurelia-router").RouteLoader; | ||
var Router = require("aurelia-router").Router; | ||
var relativeToFile = require("aurelia-path").relativeToFile; | ||
var Origin = require("aurelia-metadata").Origin; | ||
var TemplatingRouteLoader = (function () { | ||
var _RouteLoader = RouteLoader; | ||
var TemplatingRouteLoader = function TemplatingRouteLoader(compositionEngine) { | ||
var TemplatingRouteLoader = (function (RouteLoader) { | ||
function TemplatingRouteLoader(compositionEngine) { | ||
this.compositionEngine = compositionEngine; | ||
}; | ||
|
||
_inherits(TemplatingRouteLoader, _RouteLoader); | ||
} | ||
|
||
TemplatingRouteLoader.inject = function () { | ||
return [CompositionEngine]; | ||
}; | ||
_inherits(TemplatingRouteLoader, RouteLoader); | ||
|
||
TemplatingRouteLoader.prototype.loadRoute = function (router, config) { | ||
var childContainer = router.container.createChild(), instruction = { | ||
viewModel: relativeToFile(config.moduleId, Origin.get(router.container.viewModel.constructor).moduleId), | ||
childContainer: childContainer, | ||
view: config.view | ||
}, childRouter; | ||
_prototypeProperties(TemplatingRouteLoader, { | ||
inject: { | ||
value: function () { | ||
return [CompositionEngine]; | ||
}, | ||
writable: true, | ||
enumerable: true, | ||
configurable: true | ||
} | ||
}, { | ||
loadRoute: { | ||
value: function (router, config) { | ||
var childContainer = router.container.createChild(), | ||
instruction = { | ||
viewModel: relativeToFile(config.moduleId, Origin.get(router.container.viewModel.constructor).moduleId), | ||
childContainer: childContainer, | ||
view: config.view | ||
}, | ||
childRouter; | ||
|
||
childContainer.registerHandler(Router, function (c) { | ||
return childRouter || (childRouter = router.createChild(childContainer)); | ||
}); | ||
childContainer.registerHandler(Router, function (c) { | ||
return childRouter || (childRouter = router.createChild(childContainer)); | ||
}); | ||
|
||
return this.compositionEngine.createViewModel(instruction).then(function (instruction) { | ||
instruction.executionContext = instruction.viewModel; | ||
instruction.router = router; | ||
return instruction; | ||
}); | ||
}; | ||
return this.compositionEngine.createViewModel(instruction).then(function (instruction) { | ||
instruction.executionContext = instruction.viewModel; | ||
instruction.router = router; | ||
return instruction; | ||
}); | ||
}, | ||
writable: true, | ||
enumerable: true, | ||
configurable: true | ||
} | ||
}); | ||
|
||
return TemplatingRouteLoader; | ||
})(); | ||
})(RouteLoader); | ||
|
||
exports.TemplatingRouteLoader = TemplatingRouteLoader; |
Oops, something went wrong.