Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
(function ($, TSM) {
var loading;
function periodicCheck() {
showWaiting();
setTimeout(function () {
$.get(TSM.getRestPath('tap_schema/status'), function (res) {
var status = JSON.parse(res);
if (status.loading) {
periodicCheck();
} else {
if (status.error) {
hideWaiting();
TSM.showError(status.error);
} else {
// Perform redirect trick
$('#async-loader\\:open-loaded').click();
}
}
});
}, 500);
}
TSM.asyncLoader = {
init: function (l) {
loading = l;
},
startChecking: function (event) {
if (event.status === 'success') {
periodicCheck();
}
}
};
$(document).ready(function () {
if (loading) {
periodicCheck();
}
});
})(jQuery, window.TSM);