N°3685 - Performance checks on the front end - Minimize size of generated javascript

This commit is contained in:
acognet
2021-08-20 16:03:22 +02:00
parent 280afb35a9
commit bf991ffb8a

View File

@@ -35,7 +35,14 @@
{% set sId = oLayout.GetId() | sanitize(constant('utils::ENUM_SANITIZATION_FILTER_VARIABLE_NAME')) %}
{% block iboPageJsFiles %}
<script type="text/javascript">
window['{{ sPromiseId }}'] = new Promise(function(resolve, reject){
window['{{ sPromiseId }}'] = new Promise(function (resolve, reject) {
let fInlineOnDomReadyScript{{ sId }} = function () {
{% for sJsInlineOnDomReady in aPage.aJsInlineOnDomReady %}
{{ sJsInlineOnDomReady|raw }}
{% endfor %}
resolve();
}
let aFilesToLoad{{ sId }} = [];
{% for sJsFile in aPage.aJsFiles %}
@@ -66,10 +73,7 @@
}
else
{
{% for sJsInlineOnDomReady in aPage.aJsInlineOnDomReady %}
{{ sJsInlineOnDomReady|raw }}
{% endfor %}
resolve();
fInlineOnDomReadyScript{{ sId }}();
}
});
};
@@ -77,10 +81,7 @@
}
else
{
{% for sJsInlineOnDomReady in aPage.aJsInlineOnDomReady %}
{{ sJsInlineOnDomReady|raw }}
{% endfor %}
resolve();
fInlineOnDomReadyScript{{ sId }}();
}
});
</script>