diff options
author | Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi> | 2014-04-06 10:43:28 +0300 |
---|---|---|
committer | Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi> | 2014-04-06 21:33:15 +0300 |
commit | c122f63a2046469788c2f7566f200950c7192dd5 (patch) | |
tree | 38775957e758439cb49f442919a69b2c6f0ba494 | |
parent | c2122faa6c795fde62c6be67e820f9f47d7bedc2 (diff) | |
download | aconf-c122f63a2046469788c2f7566f200950c7192dd5.tar.bz2 aconf-c122f63a2046469788c2f7566f200950c7192dd5.tar.xz |
web client: reorder method
-rw-r--r-- | web/transaction.js | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/web/transaction.js b/web/transaction.js index 8c91ff6..7c2101f 100644 --- a/web/transaction.js +++ b/web/transaction.js @@ -160,6 +160,11 @@ define( var tn = _.isObject(newValue); var npv = tn ? mpath : newValue; + var prevTask = mpath in invalid && + invalid[mpath][1] || $.Deferred().resolve(); + + invalid[mpath] = [npv, def]; + function ignore(path) { _.each(_.keys(invalid), function(p) { if (pth.isSubordinate(p, path)) @@ -180,7 +185,7 @@ define( def.resolve(isValid()); } - function validate() { + prevTask.always(function() { var del = newValue == null; var options; @@ -284,16 +289,8 @@ define( else resolve(); }).fail(reject); - } - - var prevTask; - if (mpath in invalid) prevTask = invalid[mpath][1]; - - invalid[mpath] = [npv, def]; - - if (prevTask) prevTask.always(validate); - else validate(); - + }); + return def; }; |