@schibstedspain/openads-appnexus-prebid
Version:
OpenAds AppNexus connector with Prebid features
41 lines (31 loc) • 873 B
JavaScript
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var Debouncer =
/*#__PURE__*/
function () {
function Debouncer(_ref) {
var onDebounce = _ref.onDebounce,
debounceTimeout = _ref.debounceTimeout;
this._onDebounce = onDebounce;
this._debounceTimeout = debounceTimeout;
this._debounced = [];
this._timerID = null;
}
var _proto = Debouncer.prototype;
_proto.debounce = function debounce(_ref2) {
var _this = this;
var input = _ref2.input;
if (this._timerID !== null) clearTimeout(this._timerID);
this._debounced.push(input);
this._timerID = setTimeout(function () {
_this._onDebounce(_this._debounced);
_this._timerID = null;
_this._debounced = [];
}, this._debounceTimeout);
};
return Debouncer;
}();
exports.default = Debouncer;
;