EmberCliRoutePathInspector.Services.PathInspector Class
Provides additional non-invasive route tree introspection using a parallel tree of nodes
// Example Node:
{
nodeName: 'index',
isLeafNode: true,
routeName: 'index',
children: [],
depth: 1,
parent: {
nodeName: 'application',
isLeafNode: false,
routeName: 'application',
depth: 0,
children: [] // this would contain the same outer node we are dealing with
}
}
Constructor
EmberCliRoutePathInspector.Services.PathInspector
()
Item Index
Methods
Properties
Methods
isLeafRoute
-
route
Determines whether or not a given route is a leaf route within the application
let isLeafRoute = this.get('pathInspectorService').isLeafRoute(this); // true / false
Parameters:
-
route
Ember.RouteAn application route to inspect and determine whether or not it is a leaf route
Returns:
Whether or not the route is a leaf route
isLeafRouteName
-
candidateRouteName
Determines whether or not a given routeName is that of a leaf route within the application.
let isLeafRouteName = this.get('pathInspectorService').isLeafRouteName(this.get('routeName')); // true / false
Parameters:
-
candidateRouteName
StringAn application route name to inspect and determine whether or not it is a leaf route.
Returns:
Whether or not the route name is that of an application leaf route
nodeForRouteName
-
routeName
Retrieves the parallel route tree node representing the a given route name.
let node = this.get('pathInspectorService').nodeForRouteName('application.index');
// result:
{
nodeName: 'index',
isLeafNode: true,
routeName: 'index',
children: [],
depth: 1,
parent: {
nodeName: 'application',
isLeafNode: false,
routeName: 'application',
depth: 0,
children: [] // this would contain the same outer node we are dealing with
}
}
Parameters:
-
routeName
StringAn application route name to fetch a parallel tree node for
Returns:
The parallel tree node for a given route name
siblingNodesForRouteName
-
routeName
Retrieves the parallel route tree nodes representing the siblings for a given route name
// Assuming the following routes: application, application.index, application.foo
let siblingNodes = this.get('pathInspectorService').siblingNodesForRouteName('application.index');
// result:
[
{
nodeName: 'foo',
isLeafNode: true,
routeName: 'foo',
children: [],
depth: 1,
parent: {
nodeName: 'application'
}
}
]
Parameters:
-
routeName
StringA route name to fetch the sibling parallel tree nodes for
Returns:
A list of parallel tree nodes representing the siblings for a given route name
siblingPathsForRouteName
-
routeName
Retrieves the route names for the siblings of a given route name
// Assuming the following routes: application, application.index, application.foo
let siblingPaths = this.get('pathInspectorService').siblingPathsForRouteName('application.index'); // ['foo']
Parameters:
-
routeName
StringA route name to fetch the sibling route names for
Returns:
A list of found sibling route names
Properties
leafRouteMap
Object
public
A hash where route names make up the keys, which are paired with either a true or false boolean value indicating whether or not the keyed route name is that of a leaf route
// Assuming a boilerplate application with only an index route
let leafRouteMap = this.get('pathInspectorService.leafRouteMap'); // {application: false, 'application.index': true}
leafRouteNames
[String]
public
A list of all leaf route names in the application
// Assuming a boilerplate application with only an index route.
let leafRouteNames = this.get('pathInspectorService.leafRouteNames'); // ['index']
routeMapTree
Object
public
A parallel tree of nodes to that of the applications route map/tree.
// Assuming the following routes: application, application.index
let routeMapTree = this.get('pathInspectorService.routeMapTree');
// result:
{
nodeName: 'application',
routeName: 'application',
isLeafNode: false,
depth: 0,
children: [
nodeName: 'index',
routeName: 'index',
children: [],
depth: 1,
parent: {} // the same outer node we are dealing with
]
}
routes
[String]
public
A list of all route paths in the application
let routeNames = this.get('pathInspectorService.routes'); // ex. ['index', 'foo.bar', 'baz.qux']