const clearDebouncer = (name)=>{ clearTimeout(global[name]); window[name] = undefined; } const debounceFunction = (func,timer, name)=>{ clearDebouncer(name) window[name] = setTimeout(() => { func() }, timer); }