{"id":16983539,"url":"https://github.com/dbish6/async-delay-callback","last_synced_at":"2026-04-10T17:18:07.947Z","repository":{"id":224627205,"uuid":"762550743","full_name":"dBish6/async-delay-callback","owner":"dBish6","description":"A small dependency for asynchronous delays within your code! It also includes an optional callback that you can utilize.","archived":false,"fork":false,"pushed_at":"2024-03-24T19:10:08.000Z","size":56,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-04-24T14:19:24.338Z","etag":null,"topics":["async","delay","dependency","javascript","jest","npm","npm-package","promise","promises","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dBish6.png","metadata":{"files":{"readme":"README.md","changelog":"changelog.txt","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-24T03:05:42.000Z","updated_at":"2024-03-31T20:09:44.000Z","dependencies_parsed_at":"2024-02-27T00:22:09.980Z","dependency_job_id":"a2b8d6d6-b4b3-4499-98c9-c65d4e54e135","html_url":"https://github.com/dBish6/async-delay-callback","commit_stats":null,"previous_names":["dbish6/async-delay-callback"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dBish6%2Fasync-delay-callback","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dBish6%2Fasync-delay-callback/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dBish6%2Fasync-delay-callback/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dBish6%2Fasync-delay-callback/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dBish6","download_url":"https://codeload.github.com/dBish6/async-delay-callback/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244890120,"owners_count":20527030,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["async","delay","dependency","javascript","jest","npm","npm-package","promise","promises","typescript"],"created_at":"2024-10-14T02:28:48.929Z","updated_at":"2025-12-30T23:54:36.744Z","avatar_url":"https://github.com/dBish6.png","language":"TypeScript","funding_links":["https://www.buymeacoffee.com/dBish"],"categories":[],"sub_categories":[],"readme":"# async-delay-callback \n\nA small utility for asynchronous delays within your code! It also includes an optional callback that you can utilize.\n\n## Installation\nThis npm package seamlessly integrates with front-end environments and frameworks, including Vanilla, Vue, React, and more.\n\n```\n$ npm i async-delay-callback\n```\n\n## Examples\nThese are a few common use cases. The package is flexible and not restricted to these examples. \u003cbr /\u003e\n\n### React\n```\nimport { useState, useEffect } from \"react\";\nimport { delay } from \"async-delay-callback\";\n\nconst delayExample = (children) =\u003e {\n  const [loading, setLoading] = useState({ percentage: 0, complete: false });\n\n  useEffect(() =\u003e {\n    (async () =\u003e {\n      await delay(2000); // Delay without a callback.\n      console.log(\"loading\", loading)\n      \n      await delay(500, () =\u003e {\n        setLoading({ percentage: 50, complete: false });\n\n        // ...Something being loaded in.\n      });\n      console.log(\"loading\", loading)\n\n      await delay(1000, () =\u003e {\n        setLoading({ percentage: 100, complete: true });\n\n        // ...Something being loaded in.\n      });\n      console.log(\"loading\", loading)\n    })();\n  }, []);\n\n  // Renders main content after resources/features or whatever you're loading is loaded.\n  return loading.complete \u0026\u0026 \u003cmain\u003e{children}\u003c/main\u003e;\n};\n\nexport default delayExample;\n```\n\n### Other\n```\nconst { delay } = require(\"async-delay-callback\");\n\ndelay(500, () =\u003e code being delayed.);\n```\n\n## Contributing\nContributions are welcome! Although I'd like to keep this package as small as possible since it is meant to be a small utility.\n\n### To Get Started\n- Fork this repository.\n- Create a new branch.\n- install the dependencies with `npm install`.\n- Do a `npm run test` to see if you're all set.\n- For the dev environment, `npm run dev` and there you go!\n\n```\n$ npm install\n$ npm run test\n$ npm run dev\n```\n\n## License\nThis project is licensed under the [MIT](https://github.com/dBish6/async-delay-callback/blob/master/LICENSE) License.\n\n## Support Me\nIf you find this package helpful consider buying me a coffee, your support helps me stay motivated!\n\n\u003ca href=\"https://www.buymeacoffee.com/dBish\" target=\"_blank\"\u003e\u003cimg src=\"https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png\" alt=\"Buy Me A Coffee\" style=\"height: 60px !important;width: 217px !important;\" \u003e\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdbish6%2Fasync-delay-callback","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdbish6%2Fasync-delay-callback","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdbish6%2Fasync-delay-callback/lists"}