UNPKG

vanilla-recycler-view

Version:

high performance UI rendering library for web browser

25 lines 821 B
"use strict"; 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) { let timeout; return function () { const context = this; const args = arguments; const later = function () { timeout = null; if (!immediate) func.apply(context, args); }; const callNow = immediate && !timeout; window.clearTimeout(timeout); timeout = window.setTimeout(later, wait); if (callNow) func.apply(context, args); }; } exports.debounce = debounce; //# sourceMappingURL=debounce.js.map