luci-base: cbi.js: handle ui elements which return a promise in render()

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
Jo-Philipp Wich 2019-09-03 19:30:29 +02:00
parent 6d9a23af60
commit 1fcf34510a

View file

@ -321,9 +321,11 @@ function cbi_init() {
widget = new (Function.prototype.bind.apply(L.ui[args[0]], args)),
markup = widget.render();
Promise.resolve(markup).then(function(markup) {
markup.addEventListener('widget-change', cbi_d_update);
node.parentNode.replaceChild(markup, node);
});
});
cbi_d_update();
}