-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpopulateRouter.js
39 lines (36 loc) · 1012 Bytes
/
populateRouter.js
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
/*jslint browser: true */
/*global define: true */
define([
"routed/Route",
"dojo/_base/lang"
], function (
Route,
lang
) {
"use strict";
return function (application, map) {
var name = null,
makeCallback = function (widgetClass, layers) {
return function (request) {
application.makePage(request, widgetClass, layers);
};
};
for (name in map) {
if (map.hasOwnProperty(name)) {
application.router.addRoute(
name,
new Route(
map[name].schema,
lang.hitch(
application,
makeCallback(
map[name].widget,
map[name].layers || []
)
)
)
);
}
}
};
});