From adf7189e9401ab486dbb2232b0b55030cbaecc81 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 3 Mar 2021 09:56:35 +0300 Subject: show timing information in xhr.post/json --- js/common.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/js/common.js b/js/common.js index 59231010e..194fdcd9d 100755 --- a/js/common.js +++ b/js/common.js @@ -154,7 +154,10 @@ String.prototype.stripTags = function() { /* exported xhr */ const xhr = { + _ts: 0, post: function(url, params = {}, complete = undefined, failed = undefined) { + this._ts = new Date().getTime(); + console.log('xhr.post', '>>>', params); return new Promise((resolve, reject) => { @@ -171,7 +174,7 @@ const xhr = { reject(error); }, load: function(data, ioargs) { - console.log('xhr.post', '<<<', ioargs.xhr); + console.log('xhr.post', '<<<', ioargs.xhr, (new Date().getTime() - xhr._ts) + " ms"); if (complete != undefined) complete(data, ioargs.xhr); @@ -197,7 +200,7 @@ const xhr = { reject(e); } - console.log('xhr.json', '<<<', obj); + console.log('xhr.json', '<<<', obj, (new Date().getTime() - xhr._ts) + " ms"); if (obj && typeof App != "undefined") if (!App.handleRpcJson(obj)) { -- cgit v1.2.3