luci-base: form.js: support passing a callback to Map.save()

The given callback function will be executed after the map is parsed,
but before the uci is saved. This is useful to add further uci changes
before the map is re-rendered.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
Jo-Philipp Wich 2019-08-12 19:45:18 +02:00
parent 082fd9ff10
commit 3b335f2764

View file

@ -132,10 +132,11 @@ var CBIMap = CBINode.extend({
return Promise.all(tasks);
},
save: function() {
save: function(cb) {
this.checkDepends();
return this.parse()
.then(cb)
.then(uci.save.bind(uci))
.then(this.load.bind(this))
.then(this.renderContents.bind(this))