mirror of
https://github.com/rr-/szurubooru.git
synced 2025-07-17 08:26:24 +00:00
Fixed nprogress nesting
This commit is contained in:
31
public_html/js/Presenters/ProgressPresenter.js
Normal file
31
public_html/js/Presenters/ProgressPresenter.js
Normal file
@ -0,0 +1,31 @@
|
||||
var App = App || {};
|
||||
App.Controls = App.Controls || {};
|
||||
|
||||
App.Presenters.ProgressPresenter = function(nprogress) {
|
||||
var nesting = 0;
|
||||
|
||||
function start() {
|
||||
nesting ++;
|
||||
|
||||
if (nesting === 1) {
|
||||
nprogress.start();
|
||||
}
|
||||
}
|
||||
|
||||
function done() {
|
||||
nesting --;
|
||||
|
||||
if (nesting === 0) {
|
||||
nprogress.done();
|
||||
} else {
|
||||
nprogress.inc();
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
start: start,
|
||||
done: done,
|
||||
};
|
||||
}
|
||||
|
||||
App.DI.registerSingleton('progress', ['nprogress'], App.Presenters.ProgressPresenter);
|
Reference in New Issue
Block a user