mirror of
https://github.com/meineerde/redmine.git
synced 2026-03-20 15:59:53 +00:00
Reduce requests for issue ID, username, and Wiki page name autocomplete with debounce (#43208).
Patch by Katsuya HIDAKA (user:hidakatsuya). git-svn-id: https://svn.redmine.org/redmine/trunk@23978 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
7b5eeb0cb4
commit
7d6224979f
@ -1257,7 +1257,17 @@ function inlineAutoComplete(element) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const remoteSearch = function(url, cb) {
|
const debounce = function(func, delay) {
|
||||||
|
let timeout;
|
||||||
|
|
||||||
|
return function(...args) {
|
||||||
|
const context = this;
|
||||||
|
clearTimeout(timeout);
|
||||||
|
timeout = setTimeout(() => func.apply(context, args), delay);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const remoteSearch = debounce((url, cb) => {
|
||||||
const xhr = new XMLHttpRequest();
|
const xhr = new XMLHttpRequest();
|
||||||
xhr.onreadystatechange = function ()
|
xhr.onreadystatechange = function ()
|
||||||
{
|
{
|
||||||
@ -1272,7 +1282,7 @@ function inlineAutoComplete(element) {
|
|||||||
};
|
};
|
||||||
xhr.open("GET", url, true);
|
xhr.open("GET", url, true);
|
||||||
xhr.send();
|
xhr.send();
|
||||||
};
|
}, 200);
|
||||||
|
|
||||||
const tribute = new Tribute({
|
const tribute = new Tribute({
|
||||||
collection: [
|
collection: [
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user