]> git.immae.eu Git - perso/Immae/Projets/Cryptomonnaies/BIP39.git/commitdiff
Addresses shown in table as they're calculated
authorIan Coleman <coleman.ian@gmail.com>
Mon, 29 Sep 2014 06:24:06 +0000 (16:24 +1000)
committerIan Coleman <coleman.ian@gmail.com>
Mon, 29 Sep 2014 06:24:06 +0000 (16:24 +1000)
Less waiting, and doesn't block the UI.

src/js/index.js

index 5b8aedb1f866dbba395135ebc59276b9e3068343..f8b67616c530af1ae84c873a7302f6d59781ac20 100644 (file)
 
     function displayAddresses(start, total) {
         for (var i=0; i<total; i++) {
-            var index = i+ start;
-            var key = bip32ExtendedKey.derive(index);
-            var address = key.getAddress().toString();
-            var privkey = key.privKey.toWIF(network);
-            addAddressToList(index, address, privkey);
+            var index = i + start;
+            new TableRow(index);
         }
     }
 
+    function TableRow(index) {
+
+        function init() {
+            calculateValues();
+        }
+
+        function calculateValues() {
+            setTimeout(function() {
+                var key = bip32ExtendedKey.derive(index);
+                var address = key.getAddress().toString();
+                var privkey = key.privKey.toWIF(network);
+                addAddressToList(index, address, privkey);
+            }, 50)
+        }
+
+        init();
+
+    }
+
     function showMore() {
         var start = DOM.addresses.children().length;
         var rowsToAdd = parseInt(DOM.rowsToAdd.val());
                 return;
             }
         }
-        showPending();
-        setTimeout(function() {
         displayAddresses(start, rowsToAdd);
-        hidePending();
-        }, 50);
     }
 
     function clearDisplay() {