Browse Source

add abp.ui.setBusy with deferred promise

pull/1337/head
Alper Ebicoglu 7 years ago
parent
commit
3c17e5b534
  1. 31
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/freeze-ui/abp-freeze-ui.js

31
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/freeze-ui/abp-freeze-ui.js

@ -3,7 +3,7 @@
if (!window.FreezeUI || !$) {
return;
}
/* MESSAGE **************************************************/
/*Package from https://alexradulescu.github.io/freeze-ui/*/
@ -26,7 +26,7 @@
/* UI BUSY */
abp.ui.setBusy = function (element, text, freezeDelay) {
var opt = { text : text ? text : ' ' };
var opt = { text: text ? text : ' ' };
if (element) {
opt.element = element;
@ -35,10 +35,35 @@
if (freezeDelay) {
opt.freezeDelay = freezeDelay;
}
window.FreezeUI(opt);
};
abp.ui.setBusy = function (options) {
options = $.extend({}, options || {
freezeDelay: 500
});
if (!options.text) {
options.text = " ";
}
window.FreezeUI(options);
if (options.promise) {
if (options.promise.always) {
options.promise.always(function () {
abp.ui.clearBusy(options.element);
});
} else if (options.promise['finally']) {
options.promise['finally'](function () {
abp.ui.clearBusy(options.element);
});
}
}
};
abp.ui.clearBusy = function () {
window.UnFreezeUI();
};

Loading…
Cancel
Save