work on forcegraph reload

This commit is contained in:
Nils Schneider 2015-04-03 02:32:32 +02:00
commit d6e0587c55
4 changed files with 105 additions and 61 deletions

View file

@ -88,14 +88,24 @@ function (config, moment, Router, L, GUI, numeral) {
var urls = [ config.dataPath + "nodes.json",
config.dataPath + "graph.json"
]
function update() {
return Promise.all(urls.map(getJSON))
.then(handleData)
}
Promise.all(urls.map(getJSON))
.then(handleData)
update()
.then(function (d) {
var gui = new GUI(config, router)
gui.setData(d)
router.setData(d)
router.start()
window.setInterval(function () {
update().then(function (d) {
gui.setData(d)
router.setData(d)
})
}, 60000)
})
.catch(function (e) {
console.log(e)