28 lines
653 B
JavaScript
28 lines
653 B
JavaScript
/**
|
|
* DO NOT EDIT THIS FILE.
|
|
* See the following change record for more information,
|
|
* https://www.drupal.org/node/2815083
|
|
* @preserve
|
|
**/
|
|
|
|
Drupal.debounce = function (func, wait, immediate) {
|
|
var timeout = void 0;
|
|
var result = void 0;
|
|
return function () {
|
|
var context = this;
|
|
var args = arguments;
|
|
var later = function later() {
|
|
timeout = null;
|
|
if (!immediate) {
|
|
result = func.apply(context, args);
|
|
}
|
|
};
|
|
var callNow = immediate && !timeout;
|
|
clearTimeout(timeout);
|
|
timeout = setTimeout(later, wait);
|
|
if (callNow) {
|
|
result = func.apply(context, args);
|
|
}
|
|
return result;
|
|
};
|
|
}; |