Skip to content

Commit 69c701b

Browse files
committed
[ignore] refactor query.js for readability
- define file global variables at the beginning - add comment to fix custom debounce implementation
1 parent 139eb9f commit 69c701b

File tree

1 file changed

+8
-5
lines changed
  • src/main/xar-resources/resources/scripts

1 file changed

+8
-5
lines changed

src/main/xar-resources/resources/scripts/query.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
$(document).on("ready", function() {
2+
const loginDialog = $("#loginDialog");
3+
let timeout = 0;
4+
5+
loginDialog.modal({
6+
show: false
7+
});
28

39
function search() {
410
const data = $("#fun-query-form").serialize();
@@ -49,11 +55,6 @@ $(document).on("ready", function() {
4955
});
5056
}
5157

52-
let timeout = 0;
53-
const loginDialog = $("#loginDialog");
54-
loginDialog.modal({
55-
show: false
56-
});
5758
$("form", loginDialog).on("submit", function(ev) {
5859
const params = $(this).serialize();
5960
$.ajax({
@@ -73,6 +74,8 @@ $(document).on("ready", function() {
7374
$("#f-load-indicator").hide();
7475
$("#query-field").on("keyup", function() {
7576
const val = $(this).val();
77+
// fixme search request is delayed by 300ms
78+
// replace with proper debounce
7679
if (val.length > 3) {
7780
if (timeout)
7881
clearTimeout(timeout);

0 commit comments

Comments
 (0)