couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kxe...@apache.org
Subject [40/50] jquery-couch commit: updated refs/heads/import-master to 66dbcbf
Date Tue, 01 Apr 2014 08:52:45 GMT
Add view request duration to Futon

Closes COUCHDB-509


Project: http://git-wip-us.apache.org/repos/asf/couchdb-jquery-couch/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-jquery-couch/commit/2b95f339
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-jquery-couch/tree/2b95f339
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-jquery-couch/diff/2b95f339

Branch: refs/heads/import-master
Commit: 2b95f339955ff649dcaee92060b5ee87d490639b
Parents: 394922e
Author: Filipe David Borba Manana <fdmanana@apache.org>
Authored: Sat Nov 5 14:55:55 2011 +0000
Committer: Alexander Shorin <kxepal@gmail.com>
Committed: Sat Nov 5 14:55:55 2011 +0000

----------------------------------------------------------------------
 jquery.couch.js | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-jquery-couch/blob/2b95f339/jquery.couch.js
----------------------------------------------------------------------
diff --git a/jquery.couch.js b/jquery.couch.js
index 744a78a..eecd359 100644
--- a/jquery.couch.js
+++ b/jquery.couch.js
@@ -1005,7 +1005,7 @@
    * @private
    */
   function ajax(obj, options, errorMessage, ajaxOptions) {
-
+    var timeStart;
     var defaultAjaxOpts = {
       contentType: "application/json",
       headers:{"Accept": "application/json"}
@@ -1014,6 +1014,7 @@
     options = $.extend({successStatus: 200}, options);
     ajaxOptions = $.extend(defaultAjaxOpts, ajaxOptions);
     errorMessage = errorMessage || "Unknown error";
+    timeStart = (new Date()).getTime();
     $.ajax($.extend($.extend({
       type: "GET", dataType: "json", cache : !$.browser.msie,
       beforeSend: function(xhr){
@@ -1024,6 +1025,7 @@
         }
       },
       complete: function(req) {
+        var reqDuration = (new Date()).getTime() - timeStart;
         try {
           var resp = $.parseJSON(req.responseText);
         } catch(e) {
@@ -1038,11 +1040,12 @@
           options.ajaxStart(resp);
         }
         if (req.status == options.successStatus) {
-          if (options.beforeSuccess) options.beforeSuccess(req, resp);
-          if (options.success) options.success(resp);
+          if (options.beforeSuccess) options.beforeSuccess(req, resp, reqDuration);
+          if (options.success) options.success(resp, reqDuration);
         } else if (options.error) {
           options.error(req.status, resp && resp.error ||
-                        errorMessage, resp && resp.reason || "no response");
+                        errorMessage, resp && resp.reason || "no response",
+                        reqDuration);
         } else {
           alert(errorMessage + ": " + resp.reason);
         }


Mime
View raw message