UNPKG

2.17 kBJavaScriptView Raw
1'use strict';
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6
7var _Route = require('./Route');
8
9var _Route2 = _interopRequireDefault(_Route);
10
11function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
13/**
14 * Utility factory used by router to create routes.
15 */
16class RouteFactory {
17 static get $dependencies() {
18 return [];
19 }
20
21 /**
22 * Create new instance of ima.router.Route.
23 *
24 * @param {string} name The unique name of this route, identifying it among
25 * the rest of the routes in the application.
26 * @param {string} pathExpression A path expression specifying the URL path
27 * part matching this route (must not contain a query string),
28 * optionally containing named parameter placeholders specified as
29 * {@code :parameterName}.
30 * @param {string} controller The full name of Object Container alias
31 * identifying the controller associated with this route.
32 * @param {string} view The full name or Object Container alias identifying
33 * the view class associated with this route.
34 * @param {{
35 * onlyUpdate: (
36 * boolean|
37 * function(
38 * (string|function(new: Controller, ...*)),
39 * (string|function(
40 * new: React.Component,
41 * Object<string, *>,
42 * ?Object<string, *>
43 * ))
44 * ): boolean
45 * )=,
46 * autoScroll: boolean=,
47 * allowSPA: boolean=,
48 * documentView: ?AbstractDocumentView=
49 * }} options The route additional options.
50 * @return {Route} The constructed route.
51 */
52 createRoute(name, pathExpression, controller, view, options) {
53 return new _Route2.default(name, pathExpression, controller, view, options);
54 }
55}
56exports.default = RouteFactory;
57
58typeof $IMA !== 'undefined' && $IMA !== null && $IMA.Loader && $IMA.Loader.register('ima/router/RouteFactory', [], function (_export, _context) {
59 'use strict';
60 return {
61 setters: [],
62 execute: function () {
63 _export('default', exports.default);
64 }
65 };
66});