Skip to content

Commit

Permalink
Unblock UI if all AJAX calls are finished
Browse files Browse the repository at this point in the history
  • Loading branch information
piwi91 committed Mar 30, 2015
1 parent 5a8487b commit 947e015
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions Resources/private/js/bluetea/blockUi.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ $(function() {

// Private variables
_isUiBlocked: false,
_blockCount: 0,

/**
* Block UI
Expand Down Expand Up @@ -41,14 +42,18 @@ $(function() {
overlayCSS: { zIndex: 2000, backgroundColor: '#000', opacity: 0.9, cursor: 'wait' }
});
}
this._blockCount++;
},

/**
* Unblock the UI
*/
unblockUI: function() {
this._isUiBlocked = false;
$.unblockUI();
this._blockCount--;
if (this._blockCount == 0) {
this._isUiBlocked = false;
$.unblockUI();
}
},

/**
Expand Down Expand Up @@ -91,4 +96,4 @@ $(function() {
$.Widget.prototype.destroy.call(this);
}
});
}(jQuery));
}(jQuery));

0 comments on commit 947e015

Please sign in to comment.