serverless-offline-edge-lambda
Version:
A plugin for the Serverless Framework that simulates the behavior of AWS CloudFront Edge Lambdas while developing offline.
25 lines • 697 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.debounce = void 0;
const debounce = function (func, threshold, execAsap) {
let timeout;
return function debounced() {
const obj = this;
const args = arguments;
function delayed() {
if (!execAsap) {
func.apply(obj, args);
}
timeout = undefined;
}
if (timeout) {
clearTimeout(timeout);
}
else if (execAsap) {
func.apply(obj, args);
}
timeout = setTimeout(delayed, threshold || 100);
};
};
exports.debounce = debounce;
//# sourceMappingURL=debounce.js.map