Patch #43208 » 0001-Reduce-requests-for-issue-ID-username-and-Wiki-page-name-autocomplete-with-debounce.patch
| app/assets/javascripts/application-legacy.js | ||
|---|---|---|
|
}
|
||
|
}
|
||
|
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();
|
||
|
xhr.onreadystatechange = function ()
|
||
|
{
|
||
| ... | ... | |
|
};
|
||
|
xhr.open("GET", url, true);
|
||
|
xhr.send();
|
||
|
};
|
||
|
}, 300);
|
||
|
const tribute = new Tribute({
|
||
|
collection: [
|
||