work on forcegraph reload
This commit is contained in:
parent
0490455ccf
commit
d6e0587c55
4 changed files with 105 additions and 61 deletions
14
lib/main.js
14
lib/main.js
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue