diff options
author | moisseev <moiseev@mezonplus.ru> | 2020-11-20 11:25:33 +0300 |
---|---|---|
committer | moisseev <moiseev@mezonplus.ru> | 2020-11-20 11:25:33 +0300 |
commit | dfaee5db385c9990d50757310022892610d0751c (patch) | |
tree | 5a155dcbd0a31a599ede1d777c367c55b1f61ded /interface | |
parent | 4f1af03dc3c233be07caf289130690f5a9f9f3c0 (diff) | |
download | rspamd-dfaee5db385c9990d50757310022892610d0751c.tar.gz rspamd-dfaee5db385c9990d50757310022892610d0751c.zip |
[Minor] Add `complete` callback
which to be called when requests to all neighbours are finished.
Diffstat (limited to 'interface')
-rw-r--r-- | interface/js/app/rspamd.js | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/interface/js/app/rspamd.js b/interface/js/app/rspamd.js index 5312efa51..3da8a82ed 100644 --- a/interface/js/app/rspamd.js +++ b/interface/js/app/rspamd.js @@ -381,6 +381,7 @@ function ($, D3pie, visibility, NProgress, stickyTabs, tab_stat, tab_graph, tab_ } else { alertMessage("alert-error", "Request failed"); } + if (o.complete) o.complete(); NProgress.done(); } }, @@ -611,6 +612,7 @@ function ($, D3pie, visibility, NProgress, stickyTabs, tab_stat, tab_graph, tab_ * @param {string} url - A string containing the URL to which the request is sent * @param {Object} [options] - A set of key/value pairs that configure the Ajax request. All settings are optional. * + * @param {Function} [options.complete] - A function to be called when the requests to all neighbours complete. * @param {Object|string|Array} [options.data] - Data to be sent to the server. * @param {Function} [options.error] - A function to be called if the request fails. * @param {string} [options.errorMessage] - Text to display in the alert message if the request fails. @@ -629,7 +631,7 @@ function ($, D3pie, visibility, NProgress, stickyTabs, tab_stat, tab_graph, tab_ // Force options to be an object var o = options || {}; Object.keys(o).forEach(function (option) { - if (["data", "error", "errorMessage", "errorOnceId", "headers", "method", "params", "server", "statusCode", + if (["complete", "data", "error", "errorMessage", "errorOnceId", "headers", "method", "params", "server", "statusCode", "success"] .indexOf(option) < 0) { throw new Error("Unknown option: " + option); |