freifunkmanager/js/main.js

35 lines
906 B
JavaScript
Raw Normal View History

2016-07-01 11:16:39 +02:00
define(["helper/router","helper/storage","menu","controller/nodes","controller/map","controller/frame"],
function (Router, storage, menu, controllerNodes, controllerMap, controllerFrame) {
2016-07-01 08:25:32 +02:00
return function(config){
var store = storage(config)
store.refresh()
store.autorefresh(config.reload)
document.title = "eventmanager"
menu(document.body,store)
el = document.createElement("div")
el.classList.add("content")
document.body.appendChild(el)
var map = controllerMap(el,config)
store.addNotify(map)
var nodes = controllerNodes(el,config)
store.addNotify(nodes)
Router.config({
mode: 'hash'
})
2016-07-01 11:16:39 +02:00
.add(/statistics/, controllerFrame(el,config.statistics.all))
.add(/meshviewer/, controllerFrame(el,config.meshviewer))
2016-07-01 08:25:32 +02:00
.add(/list/, nodes.controller)
.add(/map\/(.*)/, map.controller)
.add(/map/, map.controller)
.add(nodes.controller)
.check().listen()
}
})