-
-
Notifications
You must be signed in to change notification settings - Fork 141
Expand file tree
/
Copy pathrouter.js
More file actions
52 lines (42 loc) · 1.19 KB
/
router.js
File metadata and controls
52 lines (42 loc) · 1.19 KB
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
52
/** @documenter yuidoc */
import EmberRouter from '@ember/routing/router';
import RouterScroll from 'ember-router-scroll';
/**
The AddonDocsRouter, which adds some extra functionality. This should be used
instead of the standard EmberRouter class in your docs app.
```js
import AddonDocsRouter, { docsRoute } from 'ember-cli-addon-docs/router';
import config from './config/environment';
const Router = AddonDocsRouter.extend({
location: config.locationType,
rootURL: config.rootURL,
});
```
@class AddonDocsRouter
@extends EmberRouter
*/
export default EmberRouter.extend(RouterScroll);
/**
Creates the docs route and api docs routes. Can receive a callback with the
routes you want to add to your docs.
```js
import AddonDocsRouter, { docsRoute } from 'ember-cli-addon-docs/router';
Router.map(function() {
docsRoute(this, function() {
this.route('usage');
});
});
```
@function docsRoute
*/
export function docsRoute(router, callback) {
router.route('docs', function() {
callback.apply(this);
});
apiRoute(router);
}
export function apiRoute(router) {
router.route('api', function() {
this.route('item', { path: '/*path' });
});
}