Added focus event to update charts
This commit is contained in:
parent
ca3de56e60
commit
9ccdee277c
1 changed files with 6 additions and 2 deletions
8
resource/web/js/hal.js
vendored
8
resource/web/js/hal.js
vendored
|
|
@ -86,9 +86,13 @@ function createChart(elementId, url, updateTime=-1){
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
updateChart(chart, url, updateTime);;
|
updateChart(chart, url, updateTime);
|
||||||
|
$(window).focus(function(e) {
|
||||||
|
updateChart(chart, url);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
function updateChart(chart, url, updateTime){
|
function updateChart(chart, url, updateTime=-1){
|
||||||
|
console.log('Updating chart: '+chart.element.id);
|
||||||
$.getJSON(url, function(json){
|
$.getJSON(url, function(json){
|
||||||
chart.load(getChartData(json));
|
chart.load(getChartData(json));
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue