aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/js/index.js18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/js/index.js b/src/js/index.js
index cee8ffb..5bdb7ab 100644
--- a/src/js/index.js
+++ b/src/js/index.js
@@ -32,6 +32,8 @@
32 DOM.privateKeyToggle = $(".private-key-toggle"); 32 DOM.privateKeyToggle = $(".private-key-toggle");
33 33
34 var derivationPath = DOM.bip44path.val(); 34 var derivationPath = DOM.bip44path.val();
35 var currentPhrase = DOM.phrase.val();
36 var currentPassphrase = DOM.passphrase.val();
35 37
36 function init() { 38 function init() {
37 // Events 39 // Events
@@ -56,6 +58,9 @@
56 // Event handlers 58 // Event handlers
57 59
58 function delayedPhraseChanged() { 60 function delayedPhraseChanged() {
61 if (!hasChanged()) {
62 return;
63 }
59 hideValidationError(); 64 hideValidationError();
60 showPending(); 65 showPending();
61 if (phraseChangeTimeoutEvent != null) { 66 if (phraseChangeTimeoutEvent != null) {
@@ -85,6 +90,9 @@
85 calcBip32Seed(phrase, passphrase, derivationPath); 90 calcBip32Seed(phrase, passphrase, derivationPath);
86 displayBip32Info(); 91 displayBip32Info();
87 hidePending(); 92 hidePending();
93 // Set current state so we only update as needed
94 currentPhrase = phrase;
95 currentPassphrase = passphrase;
88 } 96 }
89 97
90 function generateClicked() { 98 function generateClicked() {
@@ -106,7 +114,9 @@
106 } 114 }
107 115
108 function derivationChanged() { 116 function derivationChanged() {
109 delayedPhraseChanged(); 117 hideValidationError();
118 showPending();
119 setTimeout(phraseChanged, 50);
110 } 120 }
111 121
112 function bip32Changed() { 122 function bip32Changed() {
@@ -335,6 +345,12 @@
335 .hide(); 345 .hide();
336 } 346 }
337 347
348 function hasChanged() {
349 var phraseChanged = DOM.phrase.val() != currentPhrase;
350 var passphraseChanged = DOM.passphrase.val() != currentPassphrase;
351 return phraseChanged || passphraseChanged;
352 }
353
338 init(); 354 init();
339 355
340})(); 356})();