@w3ux/hooks 0.0.3 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/useEffectIgnoreInitial.js.map +1 -1
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AAAA;wCACwC;AAExC,cAAc,0BAA0B,CAAC","file":"index.js","sourcesContent":["/* @license Copyright 2024
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AAAA;wCACwC;AAExC,cAAc,0BAA0B,CAAC","file":"index.js","sourcesContent":["/* @license Copyright 2024 w3ux authors & contributors\nSPDX-License-Identifier: GPL-3.0-only */\n\nexport * from \"./useEffectIgnoreInitial\";\n"]}
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/useEffectIgnoreInitial.tsx"],"names":[],"mappings":"AAAA;wCACwC;;;;;;;;;;AAExC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE1C,MAAM,CAAC,IAAM,sBAAsB,GAAG,UAAO,EAAK,EAAE,IAAS;IAC3D,IAAM,SAAS,GAAG,MAAM,CAAU,IAAI,CAAC,CAAC;IACxC,SAAS,CACP;QACE,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;YACvB,IAAI,OAAO,EAAE,KAAK,UAAU,EAAE,CAAC;gBAC7B,EAAE,EAAE,CAAC;YACP,CAAC;QACH,CAAC;QACD,SAAS,CAAC,OAAO,GAAG,KAAK,CAAC;IAC5B,CAAC,EACD,IAAI,CAAC,CAAC,mBAAK,IAAI,QAAE,CAAC,CAAC,SAAS,CAC7B,CAAC;AACJ,CAAC,CAAC","file":"useEffectIgnoreInitial.js","sourcesContent":["/* @license Copyright 2024
|
|
1
|
+
{"version":3,"sources":["../src/useEffectIgnoreInitial.tsx"],"names":[],"mappings":"AAAA;wCACwC;;;;;;;;;;AAExC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE1C,MAAM,CAAC,IAAM,sBAAsB,GAAG,UAAO,EAAK,EAAE,IAAS;IAC3D,IAAM,SAAS,GAAG,MAAM,CAAU,IAAI,CAAC,CAAC;IACxC,SAAS,CACP;QACE,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;YACvB,IAAI,OAAO,EAAE,KAAK,UAAU,EAAE,CAAC;gBAC7B,EAAE,EAAE,CAAC;YACP,CAAC;QACH,CAAC;QACD,SAAS,CAAC,OAAO,GAAG,KAAK,CAAC;IAC5B,CAAC,EACD,IAAI,CAAC,CAAC,mBAAK,IAAI,QAAE,CAAC,CAAC,SAAS,CAC7B,CAAC;AACJ,CAAC,CAAC","file":"useEffectIgnoreInitial.js","sourcesContent":["/* @license Copyright 2024 w3ux authors & contributors\nSPDX-License-Identifier: GPL-3.0-only */\n\nimport { useEffect, useRef } from \"react\";\n\nexport const useEffectIgnoreInitial = <T, U>(fn: T, deps: U[]) => {\n const isInitial = useRef<boolean>(true);\n useEffect(\n () => {\n if (!isInitial.current) {\n if (typeof fn === \"function\") {\n fn();\n }\n }\n isInitial.current = false;\n },\n deps ? [...deps] : undefined\n );\n};\n"]}
|