{"_id":"use-delayed-loading","_rev":"33-35724cb549ea1ed896e4f8ba37a07d59","name":"use-delayed-loading","dist-tags":{"latest":"1.0.17"},"versions":{"1.0.13":{"name":"use-delayed-loading","version":"1.0.13","description":"Set loading &#x3D; true to show loader, but with a delay.","author":{"name":"miika1006"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/miika1006/use-delayed-loading.git"},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.es.js","jsnext:main":"dist/index.es.js","engines":{"node":">=8","npm":">=5"},"scripts":{"test":"cross-env CI=1 react-scripts test --env=jsdom","test:watch":"react-scripts test --env=jsdom","build":"rollup -c","start":"rollup -c -w","prepare":"yarn run build","predeploy":"cd example && yarn install && yarn run build","deploy":"gh-pages -d example/build"},"dependencies":{},"peerDependencies":{"react":">=16.8.0"},"devDependencies":{"@babel/core":"^7.3.3","@babel/runtime":"^7.3.1","@testing-library/react-hooks":"^7.0.1","@types/jest":"^27.0.1","@types/react":"^17.0.19","cross-env":"^7.0.3","gh-pages":"^3.2.3","react":"^17.0.2","react-scripts":"4.0.3","react-test-renderer":"^17.0.2","rollup":"^2.52.7","rollup-plugin-babel":"^4.3.2","rollup-plugin-commonjs":"^10.1.0","rollup-plugin-node-resolve":"^5.2.0","rollup-plugin-peer-deps-external":"^2.2.0","rollup-plugin-typescript2":"^0.30.0","rollup-plugin-url":"^3.0.1","tslib":"^2.0.1","typescript":"^4.3.5"},"keywords":["react","hook","delayed","setTimeout","loading","setLoading"],"gitHead":"aa313bde9d343daed252ee1dec6d8a4b7716f0c2","bugs":{"url":"https://github.com/miika1006/use-delayed-loading/issues"},"homepage":"https://github.com/miika1006/use-delayed-loading#readme","_id":"use-delayed-loading@1.0.13","_nodeVersion":"14.17.3","_npmVersion":"6.14.13","dist":{"integrity":"sha512-d5RMt2iLJPyNyTcax/mQ4yuX6Zgx87J7Gr+qji9VOBSHtZ2sqIWa7C/Yn3Bi3ijbWwtdkkOCSMCxehtujATd5g==","shasum":"bc36f37dc406d50d5752982387444d5ba2e988da","tarball":"https://registry.npmjs.org/use-delayed-loading/-/use-delayed-loading-1.0.13.tgz","fileCount":9,"unpackedSize":13328,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhIyZMCRA9TVsSAnZWagAAFn0P/38s51VMYJfxBO+lV58R\neXZ8O2Ptud9hhraQ6o8EMUJtmHO4QZRN5QlORXUcWzBxlC5CIM6HrjuO800W\n4R6so1IkmD33XUtubB1hoU0slcSw2Io0Pd0YpqBCu6OiVHG9tXBSxQyv/7hq\n67kcG+R4Qxsxp7lZiFltP/YZDT3LA3hWjnOeHfH59QMm3LXe/JeB/jGKMKvC\nHz/LW9JH23NgJSlE2BkZdJHuikCvpW1qb802fYGD9rOEH+XIh1MGJZbHBGKI\npc57A7YqexfxfWqiGbJ/BOtlROIOLHDYHK+vdnlx/f3twroIC4opf6YcdbRt\n+4U22QtgWbtwRBj6m6D4ajhctFtDA/3pAvjBviSTWl34UEnkfHF/Q7rmxAQv\nVCDyRh1F5faC85gfCXk7kGvJ4laP89FTO9wVTcldK3nY0lmBI9AQaUnG/R2W\n+yVGQRBwU2DheAqhBbQQzS8rPsoNdKnruF9NKkscxcE9czyk9TKxmnGUi1ma\nDok7ulMMH0uoYZU3IUKlOe+/f+oGNnXXVzTki5mWT+ew9+dbejmVWebLcKTd\npQkpiUCAjMaPmVDS8TKczB0rV7E0bU/KhEhuGEOhqIWhYomYWr6glPhuyOAq\nmYF5YDKQfNWssIk0CB06kORWw+bZyFgePO5q6ZHKNlUqJau/4KSBKADL1opE\njct9\r\n=8P5/\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDIbGpU/d/hQDS2/r50tw/LA1VIkvueNJU80aH3gIN7ggIhANVUkbIHNELhewbK1TL4j+rv8tsE3nG4Bes9PiU3coL5"}]},"_npmUser":{"name":"miika1006","email":"miika.mehtala@outlook.com"},"directories":{},"maintainers":[{"name":"miika1006","email":"miika.mehtala@outlook.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/use-delayed-loading_1.0.13_1629693516016_0.6898371159950862"},"_hasShrinkwrap":false},"1.0.14":{"name":"use-delayed-loading","version":"1.0.14","description":"Set loading &#x3D; true to show loader, but with a delay.","author":{"name":"miika1006"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/miika1006/use-delayed-loading.git"},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.es.js","jsnext:main":"dist/index.es.js","engines":{"node":">=8","npm":">=5"},"scripts":{"test":"cross-env CI=1 react-scripts test --env=jsdom","test:watch":"react-scripts test --env=jsdom","build":"rollup -c","start":"rollup -c -w","prepare":"yarn run build","predeploy":"cd example && yarn install && yarn run build","deploy":"gh-pages -d example/build"},"dependencies":{},"peerDependencies":{"react":">=16.8.0"},"devDependencies":{"@babel/core":"^7.3.3","@babel/runtime":"^7.3.1","@testing-library/react-hooks":"^7.0.1","@types/jest":"^27.0.1","@types/react":"^17.0.19","cross-env":"^7.0.3","gh-pages":"^3.2.3","react":"^17.0.2","react-scripts":"4.0.3","react-test-renderer":"^17.0.2","rollup":"^2.52.7","rollup-plugin-babel":"^4.3.2","rollup-plugin-commonjs":"^10.1.0","rollup-plugin-node-resolve":"^5.2.0","rollup-plugin-peer-deps-external":"^2.2.0","rollup-plugin-typescript2":"^0.30.0","rollup-plugin-url":"^3.0.1","tslib":"^2.0.1","typescript":"^4.3.5"},"keywords":["react","hook","delayed","setTimeout","loading","setLoading"],"gitHead":"8eaae5ec5f0b84b2807848717ab68d45c0ed19ea","bugs":{"url":"https://github.com/miika1006/use-delayed-loading/issues"},"homepage":"https://github.com/miika1006/use-delayed-loading#readme","_id":"use-delayed-loading@1.0.14","_nodeVersion":"14.17.3","_npmVersion":"6.14.13","dist":{"integrity":"sha512-PEngu4yaUd8T66tK/u2IMDW6W4C0sXimo5MRPvuXm/3rtbaE1rV81B2yjnBPMhOb5k4O0/xJykmvF61bR1ie2w==","shasum":"cc4a5466c1fd4e79daf6c33e1459f599ec20af45","tarball":"https://registry.npmjs.org/use-delayed-loading/-/use-delayed-loading-1.0.14.tgz","fileCount":9,"unpackedSize":13532,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhIyffCRA9TVsSAnZWagAAOLIP/02pZKl1Uk9gu2ZewXZR\n2UM4iItxCrV340EWDd1YFzaf2pE8313MrYw0pueag3lLYQ3orIR1er5ylNq2\nbQffdTS1rpxW+ZY4WPKg5rS60fKcNhtf/EBu3GQ0WX1v0JERgTzUXIDgd9Tw\nS4zVJfmfdFIjgL5Pnb6+EPoe8l5y3M898V54JxPax2lRs0ACgiVP6na2iwok\nkX6TILkqu7ycm08nwRiEHMdxfsaoqb9CV7IoEeELILsprs9QQQNCCPGJCIsr\nKZPU0BNvhNYn8yuiQ6Kjchg4XB1zn+PQQzkROB/Fqc47eEkztuXF09FvtzhR\nlKjqZ8sS3JcCbCM5WVuj0w0pQKOTAM1tPlBgIA5L5fDqt2pKvMTiaoZr3MF+\ngvAGYw6lM7H2E/VGYDaNu5svevJ8tnUdYloyJF4cY4Hvr4v7QJfjjr1RagqP\nllY1XSX7p2h0pWPJtji/GnVDrlScXzGHh4QB9bdQPxUKC86s8xK3uqrGex+W\nEcE1IygAw7XgwEml1d3ZEoirPlQAe29onNQkB7pROiAXy7oOJXdpYWDUko5Y\n8oj/cRYI2mVhBnbqMBtudTplpVfrt4NBO7ufNdfyW2fDAlKQHAuc3LtPc2VM\n9bbWV/E8/+LcliKIIQPYUcYZJeeI+/LYtr1lSrfuYLurnmenzfMZro695Gag\nD7jg\r\n=cny7\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGV+f8RQTxlGWbcLWdZ4PL045uwlq+7W35ePbZO+EKSWAiBZ6SLYsJiHMMlbLLfHhLcTEPYD8T9ua2VsAR8SX8SJHg=="}]},"_npmUser":{"name":"miika1006","email":"miika.mehtala@outlook.com"},"directories":{},"maintainers":[{"name":"miika1006","email":"miika.mehtala@outlook.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/use-delayed-loading_1.0.14_1629693919194_0.3312629607635589"},"_hasShrinkwrap":false},"1.0.17":{"name":"use-delayed-loading","version":"1.0.17","description":"Set loading to true to show loader, but with a delay.","author":{"name":"miika1006"},"license":"MIT","repository":{"url":"git+https://github.com/miika1006/use-delayed-loading.git","type":"git"},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.es.js","jsnext:main":"dist/index.es.js","type":"module","engines":{"node":">=8","npm":">=5"},"scripts":{"test":"cross-env CI=1 react-scripts test --env=jsdom","test:watch":"react-scripts test --env=jsdom","build":"rollup -c","start":"rollup -c -w","prepare":"yarn run build","predeploy":"cd example && yarn install && yarn run build","deploy":"gh-pages -d example/build"},"dependencies":{},"peerDependencies":{"react":">=16.8.0"},"devDependencies":{"@babel/core":"7.23.0","@babel/runtime":"7.23.1","@testing-library/react-hooks":"8.0.1","@types/jest":"29.5.5","@types/react":"18.2.23","cross-env":"7.0.3","gh-pages":"6.0.0","react":"18.2.0","react-test-renderer":"18.2.0","rollup":"3.29.4","@rollup/plugin-babel":"6.0.3","@rollup/plugin-commonjs":"25.0.4","@rollup/plugin-node-resolve":"15.2.1","rollup-plugin-peer-deps-external":"2.2.4","rollup-plugin-typescript2":"0.36.0","@rollup/plugin-url":"8.0.1","tslib":"2.6.2","typescript":"5.2.2"},"keywords":["react","hook","delayed","setTimeout","loading","setLoading"],"_id":"use-delayed-loading@1.0.17","gitHead":"e2c0637230ff687d2515697406175d84d0ee7035","bugs":{"url":"https://github.com/miika1006/use-delayed-loading/issues"},"homepage":"https://github.com/miika1006/use-delayed-loading#readme","_nodeVersion":"18.18.0","_npmVersion":"9.8.1","dist":{"integrity":"sha512-sd4mWT92ynDhMIEJD/7OuBJsTh+AkmtT7K06p8yjDXxpDIdCeerjNy4OE6AxFxFwJCGV9nGUhKySqOz/t6Nrhw==","shasum":"35e8c8d73f2d09f1410b317528143254d6f7eb30","tarball":"https://registry.npmjs.org/use-delayed-loading/-/use-delayed-loading-1.0.17.tgz","fileCount":9,"unpackedSize":14363,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDBfpCS/O9qp4gEmJFYTINneY2NI8craip/GWFSLFcKUAiEA6qQmvoy9Nv/5qbGYFwqs4DdiHJgI9uR4zGIbv6L0p5Q="}]},"_npmUser":{"name":"miika1006","email":"miika.mehtala@outlook.com"},"directories":{},"maintainers":[{"name":"miika1006","email":"miika.mehtala@outlook.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/use-delayed-loading_1.0.17_1696139290269_0.015560420637590333"},"_hasShrinkwrap":false}},"time":{"created":"2021-08-21T07:14:32.995Z","1.0.0":"2021-08-21T07:14:33.141Z","modified":"2023-10-01T05:48:10.673Z","1.0.1":"2021-08-21T08:04:30.450Z","1.0.2":"2021-08-21T08:13:06.108Z","1.0.3":"2021-08-21T08:21:05.358Z","1.0.4":"2021-08-21T08:28:23.034Z","1.0.5":"2021-08-21T08:49:10.563Z","1.0.6":"2021-08-21T08:57:06.574Z","1.0.7":"2021-08-21T09:20:51.038Z","1.0.8":"2021-08-21T09:29:45.384Z","1.0.9":"2021-08-21T09:34:53.164Z","1.0.10":"2021-08-21T09:43:13.711Z","1.0.11":"2021-08-21T09:55:44.945Z","1.0.12":"2021-08-23T04:36:34.961Z","1.0.13":"2021-08-23T04:38:36.149Z","1.0.14":"2021-08-23T04:45:19.361Z","1.0.15":"2023-10-01T04:35:15.804Z","1.0.16":"2023-10-01T05:19:21.683Z","1.0.17":"2023-10-01T05:48:10.491Z"},"maintainers":[{"name":"miika1006","email":"miika.mehtala@outlook.com"}],"description":"Set loading to true to show loader, but with a delay.","repository":{"url":"git+https://github.com/miika1006/use-delayed-loading.git","type":"git"},"author":{"name":"miika1006"},"license":"MIT","readme":"# use-delayed-loading\n\n> Custom React Hook that will set loading &#x3D; true (fe. to show loader), but with a delay.\n\n[![NPM](https://img.shields.io/npm/v/use-delayed-loading.svg)](https://www.npmjs.com/package/use-delayed-loading) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)\n\nWhen you have a random delay in a some function, for example when fetching data from server.\nThe function can run for 10 seconds or it might finish immediatelly.\nWhen that happens, you don't want to flicker a loader in your page.\nNow, there are probably many solutions to this, but this is one lazy one.\n\nDid this to test creating custom hook and publishing it to npm.\n\nUsed `npx create-react-hook` with typescript and yarn.\nCreated my hook, and then published with npm.\n\n## Install\n\n```bash\nnpm install --save use-delayed-loading\n```\n\nor\n\n```bash\nyarn add use-delayed-loading\n```\n\n## Usage\n\n```tsx\n\nimport { useDelayedLoading } from \"use-delayed-loading\";\n\nexport const MyComponent: React.FC = () => {\n  const [loading, setLoading] = useDelayedLoading(false);\n  const loadDataFromApi = async () => {\n\n    try{\n      setLoading(true);\n      const result = await fetch(...);\n      ...\n    }\n    finally{\n      setLoading(false);\n    }\n  }\n  ...\n  return loading ? \"Loading\" : \"Hello there\";\n}\n\n```\n\nYou can specify the delay yourself with a delay parameter that is 500 milliseconds by default.\n\n```tsx\n//Change delay to 1 second\nconst [loading, setLoading] = useDelayedLoading(false, 1000);\n```\n\n## License\n\nMIT © Miika Mehtälä / [miika1006](https://github.com/miika1006)\n\n---\n\nThis hook is created using [create-react-hook](https://github.com/hermanya/create-react-hook) with typescript and yarn.\n","readmeFilename":"README.md","keywords":["react","hook","delayed","setTimeout","loading","setLoading"],"homepage":"https://github.com/miika1006/use-delayed-loading#readme","bugs":{"url":"https://github.com/miika1006/use-delayed-loading/issues"}}