commit dfaee5d: [Minor] Add `complete` callback

moisseev moiseev at mezonplus.ru
Fri Nov 20 11:07:08 UTC 2020


Author: moisseev
Date: 2020-11-20 11:25:33 +0300
URL: https://github.com/rspamd/rspamd/commit/dfaee5db385c9990d50757310022892610d0751c

[Minor] Add `complete` callback
which to be called when requests to all neighbours are finished.

---
 interface/js/app/rspamd.js | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

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);


More information about the Commits mailing list