All files / ima/router RouteFactory.js

100% Statements 4/4
100% Branches 0/0
100% Functions 2/2
100% Lines 4/4
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51      5x             4x                                                                     85x       5x  
import ns from '../namespace';
import Route from './Route';
 
ns.namespace('ima.router');
 
/**
 * Utility factory used by router to create routes.
 */
export default 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 Route(name, pathExpression, controller, view, options);
  }
}
 
ns.ima.router.RouteFactory = RouteFactory;