{"name":"get-ready","version":"3.3.0","keywords":["ready","get-ready","once","event"],"author":{"url":"https://github.com/fengmk2","name":"fengmk2","email":"fengmk2@gmail.com"},"license":"MIT","_id":"get-ready@3.3.0","maintainers":[{"name":"gxkl","email":"gxkl203@gmail.com"},{"name":"eggjs-admin","email":"fengmk2+eggjs@gmail.com"},{"name":"fengmk2","email":"fengmk2@gmail.com"},{"name":"atian25","email":"atian25@qq.com"},{"name":"dead_horse","email":"dead_horse@qq.com"},{"name":"wanghx","email":"whxaxes@gmail.com"},{"name":"hyj1991","email":"yeekwanvong@gmail.com"},{"name":"killagu","email":"killa07071201@gmail.com"},{"name":"coolme200","email":"2001-wms@163.com"},{"name":"mansonchor.zzw","email":"mansonchor1987@gmail.com"},{"name":"hubcarl","email":"hubcarl@126.com"},{"name":"gemwuu","email":"gemwuu@gmail.com"},{"name":"akitasummer","email":"644171127@qq.com"},{"name":"popomore","email":"sakura9515@gmail.com"}],"homepage":"https://github.com/node-modules/get-ready#readme","bugs":{"url":"https://github.com/node-modules/get-ready/issues"},"dist":{"shasum":"49efbc9d8c66836f2efb963152a438b27ebb7e63","tarball":"http://registry-npm.ywwl.com/get-ready/download/get-ready-3.3.0.tgz","fileCount":11,"integrity":"sha512-qHVAQWeui8Xsz9PEcUju/trcSg8R02zsTOr1DvLaxLKly04SfNvzlwP7BFxMdtjqf+FhV1XmYIohcDMCDR0cAg==","signatures":[{"sig":"MEQCIHLLO657oGUyeknD0jxzHso9XJ+OJ95GQ/GYtQ6ZqZf8AiBSem05jdsfR+xtxSC8A7mQ/EtwWPOIv3qz/HBngZYucA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/get-ready@3.3.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":22816,"size":5350,"noattachment":false,"key":"/get-ready/-/get-ready-3.3.0.tgz"},"main":"./dist/commonjs/index.js","tshy":{"exports":{".":"./src/index.ts","./package.json":"./package.json"}},"type":"module","types":"./dist/commonjs/index.d.ts","module":"./dist/esm/index.js","engines":{"node":">= 16.13.0"},"exports":{".":{"import":{"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.js"},"require":{"types":"./dist/commonjs/index.d.ts","default":"./dist/commonjs/index.js"}},"./package.json":"./package.json"},"gitHead":"7f7b0a966e3dc7055b2627e4c598f596b8e639d4","scripts":{"ci":"egg-bin cov && npm run prepublishOnly && attw --pack","lint":"eslint src test --ext ts","test":"npm run lint && egg-bin test","clean":"tsc -b --clean","prepublishOnly":"tshy && tshy-after"},"_npmUser":{"name":"fengmk2","email":"fengmk2@gmail.com"},"repository":{"url":"git://github.com/node-modules/get-ready.git","type":"git"},"_npmVersion":"10.8.2","description":"mixin to add one-time ready event callback handler","directories":{},"_nodeVersion":"18.20.5","dependencies":{},"_hasShrinkwrap":false,"devDependencies":{"tshy":"3","eslint":"^8.51.0","egg-bin":"^6.4.1","tshy-after":"^1.0.0","typescript":"^5.2.2","@types/node":"^20.8.4","@types/mocha":"^10.0.2","@eggjs/tsconfig":"^1.3.3","eslint-config-egg":"^13.0.0","@arethetypeswrong/cli":"^0.17.1"},"_npmOperationalInternal":{"tmp":"tmp/get-ready_3.3.0_1734488342201_0.8671321206884344","host":"s3://npm-registry-packages-npm-production"},"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(() => 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(() => 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(() => 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(() => console.log('ready'));\n\nobj.ready(false);\nobj.ready(() => 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 => 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","publish_time":1734488342471,"_cnpm_publish_time":1734488342471,"dist-tags":{"latest":"3.4.0"}}