code formatting and cleanup
This commit is contained in:
+1
-12
@@ -39,20 +39,9 @@ define('ajax', [], function () {
|
||||
options.data = data;
|
||||
}
|
||||
|
||||
var xhr = $.ajax(options);
|
||||
|
||||
return xhr;
|
||||
|
||||
var obj = {
|
||||
then: xhr.then,
|
||||
fail: xhr.fail,
|
||||
catch: xhr.fail
|
||||
};
|
||||
|
||||
return obj;
|
||||
return $.ajax(options);
|
||||
},
|
||||
|
||||
|
||||
postRequest: function (url, data, options) {
|
||||
if (data) {
|
||||
data = JSON.stringify(data);
|
||||
|
||||
@@ -206,27 +206,37 @@ define('views/notification/badge', 'view', function (Dep) {
|
||||
|
||||
if (!url || !interval) return;
|
||||
|
||||
(new Promise(function (resolve) {
|
||||
if (this.checkBypass()) {
|
||||
resolve();
|
||||
return;
|
||||
}
|
||||
var jqxhr = Espo.Ajax.getRequest(url).done(function (list) {
|
||||
list.forEach(function (item) {
|
||||
this.showPopupNotification(name, item, isNotFirstCheck);
|
||||
}, this);
|
||||
}.bind(this));
|
||||
(new Promise(
|
||||
function (resolve) {
|
||||
if (this.checkBypass()) {
|
||||
resolve();
|
||||
return;
|
||||
}
|
||||
|
||||
jqxhr.always(function() {
|
||||
resolve();
|
||||
});
|
||||
}.bind(this))).then(function () {
|
||||
if (useWebSocket) return;
|
||||
Espo.Ajax.getRequest(url)
|
||||
.then(
|
||||
function (list) {
|
||||
list.forEach(function (item) {
|
||||
this.showPopupNotification(name, item, isNotFirstCheck);
|
||||
}, this);
|
||||
}.bind(this)
|
||||
)
|
||||
.always(
|
||||
function() {
|
||||
resolve();
|
||||
}
|
||||
);
|
||||
|
||||
this.popoupTimeouts[name] = setTimeout(function () {
|
||||
this.checkPopupNotifications(name, isNotFirstCheck);
|
||||
}.bind(this), interval * 1000);
|
||||
}.bind(this));
|
||||
}.bind(this)
|
||||
)).then(
|
||||
function () {
|
||||
if (useWebSocket) return;
|
||||
|
||||
this.popoupTimeouts[name] = setTimeout(function () {
|
||||
this.checkPopupNotifications(name, isNotFirstCheck);
|
||||
}.bind(this), interval * 1000);
|
||||
}.bind(this)
|
||||
);
|
||||
},
|
||||
|
||||
showPopupNotification: function (name, data, isNotFirstCheck) {
|
||||
|
||||
Reference in New Issue
Block a user