[habpanel] Send early update events (#129)

This change broadcasts the 'openhab-update' event immediately, not waiting for
the result of the /rest/items request, if the items are already populated, when
OHService.reloadItems() is called.  This improves the dashboard switching latency
significantly at the expanse of reliability - some widgets (e.g. slider) might
'flicker' slighly.

Signed-off-by: Yannick Schaus <github@schaus.net>
pull/130/head
Yannick Schaus 2019-10-16 08:45:05 +02:00 committed by Kai Kreuzer
parent bb1f8e6a44
commit 33307aa446
2 changed files with 6 additions and 2 deletions

View File

@ -29,6 +29,11 @@
}
function loadItems() {
/* send the update event early if the items are already there (to speed up the dashboard switches) */
if ($rootScope.items && $rootScope.items.length > 0) {
$timeout($rootScope.$emit('openhab-update'));
}
$http.get('/rest/items')
.then(function (data) {
if (angular.isArray(data.data)) {

View File

@ -209,9 +209,8 @@
vm.interactiveChartOptions.liveUpdates.fillValues = vm.widget.liveUpdates.fillValues;
}
vm.interactiveChartReady = true;
});
vm.interactiveChartReady = true;
};
var updateValue = function(item) {