From 7c95dd76064694500941ec3cfa5c348a570fa1c1 Mon Sep 17 00:00:00 2001 From: "scotty.b.brown@gmail.com" Date: Sun, 27 Feb 2011 10:50:26 +0000 Subject: [PATCH] More work on #286 - specifically the duration git-svn-id: https://beef.googlecode.com/svn/trunk@773 b87d56ec-f9c0-11de-8c8a-61c5e9addfc9 --- modules/beefjs/net.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/beefjs/net.js b/modules/beefjs/net.js index 69ad5a5cd..c2eebb935 100644 --- a/modules/beefjs/net.js +++ b/modules/beefjs/net.js @@ -125,6 +125,8 @@ beef.net = { var response = new this.response; response.was_cross_domain = cross_domain; + var start_time = new Date().getTime(); + //build and execute request $j.ajax({type: method, dataType: dataType, @@ -133,19 +135,23 @@ beef.net = { timeout: (timeout * 1000), //function on success success: function(data, textStatus, jqXHR){ + var end_time = new Date().getTime(); console.log(data); //TODO remove after testing response.status_code = "200"; response.response_body = data; response.port_status = "open"; response.was_timedout = false; + response.duration = (end_time - start_time); }, //function on failure error: function(jqXHR, textStatus, errorThrown){ + var end_time = new Date().getTime(); console.log(errorThrown); //TODO remove after testing response.status_code = "TODO: errorThrown"; + response.duration = end_time - start_time; } }); - //return response; + return response; }, /**