cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From an-s...@apache.org
Subject cordova-wp8 git commit: CB-9572 Get rid of Math.random() when making a request ID
Date Fri, 28 Aug 2015 12:55:28 GMT
Repository: cordova-wp8
Updated Branches:
  refs/heads/master fed5953c2 -> ec401c9e2


CB-9572 Get rid of Math.random() when making a request ID

Math.random() takes several seconds to work (at least on my Lumia 820)! That's why, when using
AngularJS routing I experienced huge delays when loading partial views. This little change
fixed that.

This closes #86


Project: http://git-wip-us.apache.org/repos/asf/cordova-wp8/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-wp8/commit/ec401c9e
Tree: http://git-wip-us.apache.org/repos/asf/cordova-wp8/tree/ec401c9e
Diff: http://git-wip-us.apache.org/repos/asf/cordova-wp8/diff/ec401c9e

Branch: refs/heads/master
Commit: ec401c9e2c1403165032de1b183203279d2170ca
Parents: fed5953
Author: Konstantin Lepeshenkov <konstantin.lepeshenkov@gmail.com>
Authored: Sun Jul 19 00:12:25 2015 +0300
Committer: Vladimir Kotikov <v-vlkoti@microsoft.com>
Committed: Fri Aug 28 15:50:20 2015 +0300

----------------------------------------------------------------------
 template/cordovalib/XHRHelper.cs | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-wp8/blob/ec401c9e/template/cordovalib/XHRHelper.cs
----------------------------------------------------------------------
diff --git a/template/cordovalib/XHRHelper.cs b/template/cordovalib/XHRHelper.cs
index 1d72367..50120ca 100644
--- a/template/cordovalib/XHRHelper.cs
+++ b/template/cordovalib/XHRHelper.cs
@@ -77,6 +77,7 @@ namespace WPCordovaClassLib.CordovaLib
         XHRShim.HEADERS_RECEIVED = 2;
         XHRShim.LOADING = 3;
         XHRShim.DONE = 4;
+        XHRShim.incrementedCounter = 0;
         XHRShim.prototype = {
             isAsync: false,
             onreadystatechange: null,
@@ -263,7 +264,7 @@ namespace WPCordovaClassLib.CordovaLib
                     }
 
                     // Generate unique request ID
-                    var reqId = new Date().getTime().toString() + Math.random();
+                    var reqId = new Date().getTime().toString() + XHRShim.incrementedCounter++;
 
                     var funk = function () {
                         __XHRShimAliases[reqId] = alias;


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message