vanilla-recycler-view
Version:
high performance UI rendering library for web browser
25 lines • 813 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.debounce = void 0;
/* eslint-disable prefer-rest-params */
/* eslint-disable @typescript-eslint/no-this-alias */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
function debounce(func, wait, immediate) {
var timeout;
return function () {
var context = this;
var args = arguments;
var later = function () {
timeout = null;
if (!immediate)
func.apply(context, args);
};
var callNow = immediate && !timeout;
window.clearTimeout(timeout);
timeout = window.setTimeout(later, wait);
if (callNow)
func.apply(context, args);
};
}
exports.debounce = debounce;
//# sourceMappingURL=debounce.js.map