Loading bar: Introduced two event listeners on window 'pillar:workStart' and 'pillar:workStop' that (de)activates the loading bar.

Reason:
* To decouple code
* Have the loading bar active until whole page stopped working
* Have local loading info

Usage:
$.('.myClass')
   .on('pillar:workStart', function(){
    ... do stuff locally while loading ...
    })
   .on('pillar:workStop', function(){
   ... stop do stuff locally while loading ...
   })

$.('.myClass .mySubClass').trigger('pillar:workStart')
... do stuff ...
$.('.myClass .mySubClass').trigger('pillar:workStop')
This commit is contained in:
2018-10-23 13:57:02 +02:00
parent a674de4db5
commit 0b2a3c99ce
2 changed files with 14 additions and 10 deletions

View File

@@ -25,7 +25,7 @@
if (!node.picture) {
warnNoPicture();
} else {
loadingBarShow();
$(window).trigger('pillar:workStart');
// TODO: show 'loading' thingy
$.get('/api/files/' + node.picture)
@@ -34,7 +34,6 @@
console.log(msg);
})
.done(function(resp) {
loadingBarHide();
// Render the picture if it has the proper size.
var show_variation = null;
@@ -57,6 +56,9 @@
.attr('width', variation.width)
.attr('height', variation.height);
thumbnail_container.append(img);
})
.always(function(){
$(window).trigger('pillar:workStop');
});
}