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
This commit is contained in:
boyska 2019-11-16 02:20:40 +01:00
parent 0bad389a9e
commit 7df8d60f1b

View file

@ -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();