Remove unused debounce function

This commit is contained in:
Pedro Silva 2023-07-21 10:39:18 +01:00
parent 84a362a7c5
commit 044a704048
No known key found for this signature in database
GPG key ID: E2EE20C0669D24B3
2 changed files with 2 additions and 17 deletions

View file

@ -31,20 +31,6 @@ export const strRemoveWord = (str, word, separator = ',') => {
return arr.join(separator);
};
export const debounce = (func, wait) => {
let timeout;
return function() {
const context = this;
const args = arguments;
const later = function() {
timeout = null;
func.apply(context, args);
};
clearTimeout(timeout);
timeout = setTimeout(later, wait);
};
}
export const throttle = (func, limit) => {
let inThrottle, lastArgs, lastContext;
@ -77,7 +63,6 @@ const Utils = {
keysToCamelCase,
strAddWord,
strRemoveWord,
debounce,
throttle
};

View file

@ -98,8 +98,8 @@ class Renderer {
}
jQuery(document)
.off('ppcp-reload-buttons', wrapper)
.on('ppcp-reload-buttons', wrapper, (event, settingsOverride = {}) => {
.off(this.reloadEventName, wrapper)
.on(this.reloadEventName, wrapper, (event, settingsOverride = {}) => {
const settings = merge(this.defaultSettings, settingsOverride);
let scriptOptions = keysToCamelCase(settings.url_params);
scriptOptions = merge(scriptOptions, settings.script_attributes);