UNPKG

ima

Version:

IMA.js framework for isomorphic javascript application

70 lines (59 loc) 2.17 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _Route = require("./Route"); var _Route2 = _interopRequireDefault(_Route); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /** * Utility factory used by router to create routes. */ class RouteFactory { static get $dependencies() { return []; } /** * Create new instance of ima.router.Route. * * @param {string} name The unique name of this route, identifying it among * the rest of the routes in the application. * @param {string} pathExpression A path expression specifying the URL path * part matching this route (must not contain a query string), * optionally containing named parameter placeholders specified as * {@code :parameterName}. * @param {string} controller The full name of Object Container alias * identifying the controller associated with this route. * @param {string} view The full name or Object Container alias identifying * the view class associated with this route. * @param {{ * onlyUpdate: ( * boolean| * function( * (string|function(new: Controller, ...*)), * (string|function( * new: React.Component, * Object<string, *>, * ?Object<string, *> * )) * ): boolean * )=, * autoScroll: boolean=, * allowSPA: boolean=, * documentView: ?AbstractDocumentView= * }} options The route additional options. * @return {Route} The constructed route. */ createRoute(name, pathExpression, controller, view, options) { return new _Route2.default(name, pathExpression, controller, view, options); } } exports.default = RouteFactory; typeof $IMA !== 'undefined' && $IMA !== null && $IMA.Loader && $IMA.Loader.register('ima/router/RouteFactory', [], function (_export, _context) { 'use strict'; return { setters: [], execute: function () { _export('default', exports.default); } }; });