js: debounce name change

This commit is contained in:
boyska 2019-11-16 12:31:14 +01:00
parent 7df8d60f1b
commit 97c74d8542
3 changed files with 10 additions and 3 deletions

View file

@ -13,6 +13,7 @@
<script src="/static/js/jquery-1.9.1.min.js"></script>
<script src="/static/js/jquery-ui.min.js"></script>
<script src="/static/js/jquery.ui.datepicker-it.min.js"></script>
<script src="/static/js/underscore-min.js"></script>
<script src="/static/js/rec.js"></script>
<script src="/static/js/ui.js"></script>
<script src="/static/js/new.js"></script>

View file

@ -1,4 +1,4 @@
/*global $, config, RecAPI, poll_job*/
/*global $, config, RecAPI, poll_job, _*/
//TODO: move to a separate file(?)
$.widget("ror.countclock", {
@ -82,7 +82,8 @@ $.widget("ror.ongoingrec", {
);
this._update();
view.on("change keydown paste input", "input", function(evt) {
view.on("change keydown paste input", "input",
_.debounce(function onNameChanged(evt) {
console.log('change', evt);
var prevrec = widget.options.rec;
prevrec.name = $(evt.target).val();
@ -90,7 +91,7 @@ $.widget("ror.ongoingrec", {
widget._trigger("change", evt,
{rec: rec, widget: widget, changed: {name: rec.name}}
);
});
}, 500));
view.on("click", ".rec-stop", function(evt) {
widget._trigger("stop", evt, {rec: rec, widget: widget});
});

5
server/static/js/underscore-min.js vendored Normal file

File diff suppressed because one or more lines are too long