aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Coleman <coleman.ian@gmail.com>2014-09-29 16:24:06 +1000
committerIan Coleman <coleman.ian@gmail.com>2014-09-29 16:24:06 +1000
commita8c454871dafb83d47f65367ef46e64e4e47589f (patch)
treee62c24df52f93679be894d2e8308456fa48ad15e
parente66c8a9b5aade1c6b19c58e5366f777fde3f373f (diff)
downloadBIP39-a8c454871dafb83d47f65367ef46e64e4e47589f.tar.gz
BIP39-a8c454871dafb83d47f65367ef46e64e4e47589f.tar.zst
BIP39-a8c454871dafb83d47f65367ef46e64e4e47589f.zip
Addresses shown in table as they're calculated
Less waiting, and doesn't block the UI.
-rw-r--r--src/js/index.js30
1 files changed, 21 insertions, 9 deletions
diff --git a/src/js/index.js b/src/js/index.js
index 5b8aedb..f8b6761 100644
--- a/src/js/index.js
+++ b/src/js/index.js
@@ -239,14 +239,30 @@
239 239
240 function displayAddresses(start, total) { 240 function displayAddresses(start, total) {
241 for (var i=0; i<total; i++) { 241 for (var i=0; i<total; i++) {
242 var index = i+ start; 242 var index = i + start;
243 var key = bip32ExtendedKey.derive(index); 243 new TableRow(index);
244 var address = key.getAddress().toString();
245 var privkey = key.privKey.toWIF(network);
246 addAddressToList(index, address, privkey);
247 } 244 }
248 } 245 }
249 246
247 function TableRow(index) {
248
249 function init() {
250 calculateValues();
251 }
252
253 function calculateValues() {
254 setTimeout(function() {
255 var key = bip32ExtendedKey.derive(index);
256 var address = key.getAddress().toString();
257 var privkey = key.privKey.toWIF(network);
258 addAddressToList(index, address, privkey);
259 }, 50)
260 }
261
262 init();
263
264 }
265
250 function showMore() { 266 function showMore() {
251 var start = DOM.addresses.children().length; 267 var start = DOM.addresses.children().length;
252 var rowsToAdd = parseInt(DOM.rowsToAdd.val()); 268 var rowsToAdd = parseInt(DOM.rowsToAdd.val());
@@ -261,11 +277,7 @@
261 return; 277 return;
262 } 278 }
263 } 279 }
264 showPending();
265 setTimeout(function() {
266 displayAddresses(start, rowsToAdd); 280 displayAddresses(start, rowsToAdd);
267 hidePending();
268 }, 50);
269 } 281 }
270 282
271 function clearDisplay() { 283 function clearDisplay() {