package.react-utils.useFuncDebounce.useFuncDebounce.js.map Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of neeto-commons-frontend Show documentation
Show all versions of neeto-commons-frontend Show documentation
A package encapsulating common code across neeto projects including initializers, utility functions, common components and hooks and so on.
{"version":3,"file":"useFuncDebounce.js","names":["useRef","useFuncDebounce","func","delay","arguments","length","undefined","timer","debouncedFunc","_len","args","Array","_key","clearTimeout","current","setTimeout","apply","cancel"],"sources":["../../../src/react-utils/useFuncDebounce/useFuncDebounce.js"],"sourcesContent":["import { useRef } from \"react\";\n\nconst useFuncDebounce = (func, delay = 350) => {\n const timer = useRef(null);\n const debouncedFunc = (...args) => {\n clearTimeout(timer.current);\n timer.current = setTimeout(() => func(...args), delay);\n };\n debouncedFunc.cancel = () => clearTimeout(timer.current);\n\n return debouncedFunc;\n};\n\nexport default useFuncDebounce;\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,OAAO;AAE9B,IAAMC,eAAe,GAAG,SAAlBA,eAAeA,CAAIC,IAAI,EAAkB;EAAA,IAAhBC,KAAK,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,GAAG;EACxC,IAAMG,KAAK,GAAGP,MAAM,CAAC,IAAI,CAAC;EAC1B,IAAMQ,aAAa,GAAG,SAAhBA,aAAaA,CAAA,EAAgB;IAAA,SAAAC,IAAA,GAAAL,SAAA,CAAAC,MAAA,EAATK,IAAI,OAAAC,KAAA,CAAAF,IAAA,GAAAG,IAAA,MAAAA,IAAA,GAAAH,IAAA,EAAAG,IAAA;MAAJF,IAAI,CAAAE,IAAA,IAAAR,SAAA,CAAAQ,IAAA;IAAA;IAC5BC,YAAY,CAACN,KAAK,CAACO,OAAO,CAAC;IAC3BP,KAAK,CAACO,OAAO,GAAGC,UAAU,CAAC;MAAA,OAAMb,IAAI,CAAAc,KAAA,SAAIN,IAAI,CAAC;IAAA,GAAEP,KAAK,CAAC;EACxD,CAAC;EACDK,aAAa,CAACS,MAAM,GAAG;IAAA,OAAMJ,YAAY,CAACN,KAAK,CAACO,OAAO,CAAC;EAAA;EAExD,OAAON,aAAa;AACtB,CAAC;AAED,eAAeP,eAAe"}