File tree Expand file tree Collapse file tree
view/base/templates/script Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ if ($interval < 10) {
2727 const LokiAjaxQueue = {
2828 requests: [],
2929 interval: <?= (int )$ interval ?> ,
30+ loading: false,
3031 add(component, update) {
3132 this.requests.push({
3233 component,
@@ -38,6 +39,10 @@ if ($interval < 10) {
3839 this.post();
3940 }, this.interval);
4041 },
42+ setLoading(loading) {
43+ this.loading = loading;
44+ document.dispatchEvent(new CustomEvent('loki-components.ajax.loading', {detail: loading}));
45+ },
4146 async post() {
4247 if (!this.requests.length > 0) {
4348 return;
@@ -53,6 +58,7 @@ if ($interval < 10) {
5358 request.component.beforePost();
5459 });
5560
61+ this.setLoading(true);
5662 this.requests = [];
5763
5864 await fetch('<?= $ escaper ->escapeUrl ($ componentUtil ->getPostUrl (
@@ -92,6 +98,8 @@ if ($interval < 10) {
9298 requests.forEach(request => {
9399 request.component.afterPostFinally();
94100 });
101+
102+ this.setLoading(false);
95103 });
96104 },
97105 getPostHeaders() {
You can’t perform that action at this time.
0 commit comments