Browse Source

js: name changed while typing

there used to be a slight bug. Suppose the user types a text in the
input box, and never changes the focus.
Then, she press "Stop". the click and the focus lost happen in nearly
the same moment, which leads to a race in which the name is set only if
the /api/update arrives before the /api/generate.

Sending the message before losing the focus mitigates the issue
boyska 4 years ago
parent
commit
7df8d60f1b
1 changed files with 1 additions and 1 deletions
  1. 1 1
      server/static/js/new.js

+ 1 - 1
server/static/js/new.js

@@ -82,7 +82,7 @@ $.widget("ror.ongoingrec", {
 		);
 		this._update();
 
-		view.on("change", "input", function(evt) {
+		view.on("change keydown paste input", "input", function(evt) {
 			console.log('change', evt);
 			var prevrec = widget.options.rec;
 			prevrec.name = $(evt.target).val();