{"id":28684898,"url":"https://github.com/node-modules/get-ready","last_synced_at":"2025-06-14T03:07:39.474Z","repository":{"id":172627973,"uuid":"649481410","full_name":"node-modules/get-ready","owner":"node-modules","description":"NodeJS mixin to add one-time ready event","archived":false,"fork":false,"pushed_at":"2024-12-18T06:58:15.000Z","size":47,"stargazers_count":2,"open_issues_count":1,"forks_count":1,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-06-06T05:35:05.874Z","etag":null,"topics":[],"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/node-modules.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2023-06-05T00:56:25.000Z","updated_at":"2024-12-18T06:58:18.000Z","dependencies_parsed_at":null,"dependency_job_id":"a5ae67b0-df72-4d1c-91b3-e5c61a732aca","html_url":"https://github.com/node-modules/get-ready","commit_stats":null,"previous_names":["node-modules/get-ready"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/node-modules/get-ready","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-modules%2Fget-ready","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-modules%2Fget-ready/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-modules%2Fget-ready/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-modules%2Fget-ready/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/node-modules","download_url":"https://codeload.github.com/node-modules/get-ready/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-modules%2Fget-ready/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259752078,"owners_count":22905972,"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":[],"created_at":"2025-06-14T03:07:32.798Z","updated_at":"2025-06-14T03:07:39.458Z","avatar_url":"https://github.com/node-modules.png","language":"TypeScript","readme":"# get-ready\n\n[![NPM version][npm-image]][npm-url]\n[![CI](https://github.com/node-modules/get-ready/actions/workflows/nodejs.yml/badge.svg)](https://github.com/node-modules/get-ready/actions/workflows/nodejs.yml)\n[![Test coverage][codecov-image]][codecov-url]\n[![npm download][download-image]][download-url]\n[![Node.js Version](https://img.shields.io/node/v/get-ready.svg?style=flat)](https://nodejs.org/en/download/)\n\n[npm-image]: https://img.shields.io/npm/v/get-ready.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/get-ready\n[codecov-image]: https://codecov.io/github/node-modules/get-ready/coverage.svg?branch=master\n[codecov-url]: https://codecov.io/github/node-modules/get-ready?branch=master\n[download-image]: https://img.shields.io/npm/dm/get-ready.svg?style=flat-square\n[download-url]: https://npmjs.org/package/get-ready\n\n**Fork from [supershabam/ready](https://github.com/supershabam/ready)**\n\none-time ready event object.\n\n## Usage\n\nCreate `ready` event object.\n\n```ts\nimport { Ready } from 'get-ready';\n\nconst obj = new Ready();\n\n// register a callback\nobj.ready(() =\u003e console.log('ready'));\n\n// mark ready\nobj.ready(true);\n```\n\n### Register\n\nRegister a callback to the callback stack, it will be called when mark as ready, see example above.\n\nIf the callback is undefined, register will return a promise.\n\n```ts\nobj.ready().then(() =\u003e console.log('ready'));\nobj.ready(true);\n```\n\nIf it has been ready, the callback will be called immediately.\n\n```ts\n// already ready\nobj.ready(true);\nobj.ready().then(() =\u003e console.log('ready'));\n```\n\n### ReadyEventEmitter\n\n```ts\nimport { ReadyEventEmitter } from 'get-ready';\n\nclass MyClass extends ReadyEventEmitter {\n  // your handler here\n}\n```\n\n**Warning: the callback is called after nextTick**\n\n### Emit\n\nMark it as ready, you can simply using `.ready(true)`.\n\nYou can also mark it not ready.\n\n```ts\nobj.ready(true);\n// call immediately\nobj.ready(() =\u003e console.log('ready'));\n\nobj.ready(false);\nobj.ready(() =\u003e throw 'don\\'t run');\n```\n\nWhen exception throws, you can pass an error object, then the callback will receive it as the first argument.\n\n```ts\nobj.ready(err =\u003e console.log(err));\nobj.ready(new Error('err'));\n```\n\n## License\n\n[MIT](LICENSE)\n\n## Contributors\n\n[![Contributors](https://contrib.rocks/image?repo=node-modules/get-ready)](https://github.com/node-modules/get-ready/graphs/contributors)\n\nMade with [contributors-img](https://contrib.rocks).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnode-modules%2Fget-ready","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnode-modules%2Fget-ready","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnode-modules%2Fget-ready/lists"}