aboutsummaryrefslogtreecommitdiff
path: root/bip39-standalone.html
diff options
context:
space:
mode:
authorIan Coleman <coleman.ian@gmail.com>2017-01-04 11:30:45 +1100
committerIan Coleman <coleman.ian@gmail.com>2017-01-04 11:31:45 +1100
commit40892aba5013cd75927f63e66492f46b2d206ec9 (patch)
tree35f45854960e6fd6c30a11016ac89dc000977053 /bip39-standalone.html
parent6ea15134a4ff5a443d96de5882bcddbe7300fc6f (diff)
downloadBIP39-40892aba5013cd75927f63e66492f46b2d206ec9.tar.gz
BIP39-40892aba5013cd75927f63e66492f46b2d206ec9.tar.zst
BIP39-40892aba5013cd75927f63e66492f46b2d206ec9.zip
Generation process stopped when table rows cleared
Closes #44
Diffstat (limited to 'bip39-standalone.html')
-rw-r--r--bip39-standalone.html35
1 files changed, 31 insertions, 4 deletions
diff --git a/bip39-standalone.html b/bip39-standalone.html
index 5158b10..afef084 100644
--- a/bip39-standalone.html
+++ b/bip39-standalone.html
@@ -18664,6 +18664,8 @@ window.Entropy = new (function() {
18664 var phraseChangeTimeoutEvent = null; 18664 var phraseChangeTimeoutEvent = null;
18665 var rootKeyChangedTimeoutEvent = null; 18665 var rootKeyChangedTimeoutEvent = null;
18666 18666
18667 var generationProcesses = [];
18668
18667 var DOM = {}; 18669 var DOM = {};
18668 DOM.network = $(".network"); 18670 DOM.network = $(".network");
18669 DOM.phraseNetwork = $("#network-phrase"); 18671 DOM.phraseNetwork = $("#network-phrase");
@@ -19157,14 +19159,28 @@ window.Entropy = new (function() {
19157 } 19159 }
19158 19160
19159 function displayAddresses(start, total) { 19161 function displayAddresses(start, total) {
19160 for (var i=0; i<total; i++) { 19162 generationProcesses.push(new (function() {
19161 var index = i + start; 19163
19162 new TableRow(index); 19164 var rows = [];
19163 } 19165
19166 this.stop = function() {
19167 for (var i=0; i<rows.length; i++) {
19168 rows[i].shouldGenerate = false;
19169 }
19170 }
19171
19172 for (var i=0; i<total; i++) {
19173 var index = i + start;
19174 rows.push(new TableRow(index));
19175 }
19176
19177 })());
19164 } 19178 }
19165 19179
19166 function TableRow(index) { 19180 function TableRow(index) {
19167 19181
19182 var self = this;
19183 this.shouldGenerate = true;
19168 var useHardenedAddresses = DOM.hardenedAddresses.prop("checked"); 19184 var useHardenedAddresses = DOM.hardenedAddresses.prop("checked");
19169 19185
19170 function init() { 19186 function init() {
@@ -19173,6 +19189,9 @@ window.Entropy = new (function() {
19173 19189
19174 function calculateValues() { 19190 function calculateValues() {
19175 setTimeout(function() { 19191 setTimeout(function() {
19192 if (!self.shouldGenerate) {
19193 return;
19194 }
19176 var key = ""; 19195 var key = "";
19177 if (useHardenedAddresses) { 19196 if (useHardenedAddresses) {
19178 key = bip32ExtendedKey.deriveHardened(index); 19197 key = bip32ExtendedKey.deriveHardened(index);
@@ -19223,6 +19242,14 @@ window.Entropy = new (function() {
19223 19242
19224 function clearAddressesList() { 19243 function clearAddressesList() {
19225 DOM.addresses.empty(); 19244 DOM.addresses.empty();
19245 stopGenerating();
19246 }
19247
19248 function stopGenerating() {
19249 while (generationProcesses.length > 0) {
19250 var generation = generationProcesses.shift();
19251 generation.stop();
19252 }
19226 } 19253 }
19227 19254
19228 function clearKey() { 19255 function clearKey() {