{"version":3,"sources":["src/utils/decorators/debounce/debounce.decorator.ts"],"names":["Debounce","duration","keyFn","_target","key","descriptor","originalMethod","value","length","console","error","args","this","__debounce","debounceKey","clearTimeout","setTimeout","call"],"mappings":"MAIaA,EAAW,CAACC,EAAkBC,IAClC,CAACC,EAAcC,EAAaC,KACjC,MAAMC,EAAiBD,EAAWE,MAElC,GAAIL,GAASA,EAAMM,OAASF,EAAeE,OAAQ,CACjDC,QAAQC,MAAM,6EAA6EN,QAG7FC,EAAWE,MAAQ,YAAaI,GAC9BC,KAAKC,WAAaD,KAAKC,YAAc,GACrC,MAAMC,EAAcZ,EAAQ,GAAGE,KAAOF,KAASS,KAAUP,EACzDW,aAAaH,KAAKC,WAAWC,IAC7BF,KAAKC,WAAWC,GAAeE,YAAW,KACxCV,EAAeW,KAAKL,QAASD,KAC5BV","sourcesContent":["/**\n * Debounce is used to postpone the decorated method execution until after wait milliseconds have elapsed since the last time it was invoked.\n * @param duration Duration of waiting time in milliseconds\n */\nexport const Debounce = (duration: number, keyFn?: (...args) => string) => {\n return (_target: any, key: string, descriptor: PropertyDescriptor): void => {\n const originalMethod = descriptor.value;\n\n if (keyFn && keyFn.length > originalMethod.length) {\n console.error(`Debounce decorator keyFn argument list must match the decorated function (${key}). `);\n }\n\n descriptor.value = function (...args) {\n this.__debounce = this.__debounce || {};\n const debounceKey = keyFn ? `${key}.${keyFn(...args)}` : key;\n clearTimeout(this.__debounce[debounceKey]);\n this.__debounce[debounceKey] = setTimeout(() => {\n originalMethod.call(this, ...args);\n }, duration);\n };\n };\n};\n"]}