summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--modules/luci-base/htdocs/luci-static/resources/cbi.js8
1 files changed, 5 insertions, 3 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/cbi.js b/modules/luci-base/htdocs/luci-static/resources/cbi.js
index 9144fbaf6..4c3128bfd 100644
--- a/modules/luci-base/htdocs/luci-static/resources/cbi.js
+++ b/modules/luci-base/htdocs/luci-static/resources/cbi.js
@@ -314,18 +314,20 @@ function cbi_init() {
i.addEventListener('mouseout', handler);
});
+ var tasks = [];
+
document.querySelectorAll('[data-ui-widget]').forEach(function(node) {
var args = JSON.parse(node.getAttribute('data-ui-widget') || '[]'),
widget = new (Function.prototype.bind.apply(L.ui[args[0]], args)),
markup = widget.render();
- Promise.resolve(markup).then(function(markup) {
+ tasks.push(Promise.resolve(markup).then(function(markup) {
markup.addEventListener('widget-change', cbi_d_update);
node.parentNode.replaceChild(markup, node);
- });
+ }));
});
- cbi_d_update();
+ Promise.all(tasks).then(cbi_d_update);
}
function cbi_validate_form(form, errmsg)