You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
955 B
42 lines
955 B
Demo = { |
|
version: 1.0 |
|
}; |
|
$(function () { |
|
var ref; |
|
|
|
BI.each(Demo.CONFIG, function (index, item) { |
|
!item.id && (item.id = item.value || item.text); |
|
}); |
|
var tree = BI.Tree.transformToTreeFormat(Demo.CONFIG); |
|
|
|
var obj = { |
|
routes: { |
|
"": "index" |
|
}, |
|
index: function () { |
|
Demo.showIndex = "demo.face"; |
|
} |
|
}; |
|
|
|
BI.Tree.traversal(tree, function (index, node) { |
|
if (!node.children || BI.isEmptyArray(node.children)) { |
|
obj.routes[node.text] = node.text; |
|
obj[node.text] = function () { |
|
Demo.showIndex = node.value; |
|
}; |
|
} |
|
}); |
|
|
|
var AppRouter = BI.inherit(BI.Router, obj); |
|
new AppRouter; |
|
BI.history.start(); |
|
|
|
BI.createWidget({ |
|
type: "demo.main", |
|
ref: function (_ref) { |
|
console.log(_ref); |
|
ref = _ref; |
|
}, |
|
element: "#wrapper" |
|
}); |
|
}); |