setTimeout( function() { ev.target.select(); ev.target.focus(); }, 0);
}
if (xulG.unified_interface) {
- g.gather_copies();
- try {
- xulG.refresh_copy_editor();
- } catch(E) {
- alert('Error in volume_copy_editor.js trying to call xulG.refresh_copy_editor(): ' + E);
+ if (g.update_copy_editor_timeoutID) {
+ clearTimeout(g.update_copy_editor_timeoutID);
}
+ // This function is expensive when it comes to keeping the UI responsive, so let's give it a delay
+ // that quick entry of consecutive barcodes can override
+ g.update_copy_editor_timeoutID = setTimeout(
+ function() {
+ g.gather_copies();
+ try {
+ xulG.refresh_copy_editor();
+ } catch(E) {
+ alert('Error in volume_copy_editor.js trying to call xulG.refresh_copy_editor(): ' + E);
+ }
+ }, 2000
+ );
}
}, false);
tb.addEventListener( 'focus', function(ev) { g.last_focus = ev.target; }, false );