From 3b335f2764bfda3f18e13bf492e461977599e411 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Mon, 12 Aug 2019 19:45:18 +0200 Subject: 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 --- modules/luci-base/htdocs/luci-static/resources/form.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/luci-base/htdocs/luci-static/resources/form.js b/modules/luci-base/htdocs/luci-static/resources/form.js index 9c5cb9365..44a2df22f 100644 --- a/modules/luci-base/htdocs/luci-static/resources/form.js +++ b/modules/luci-base/htdocs/luci-static/resources/form.js @@ -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)) -- cgit v1.2.3