{"_id":"ready-callback","_rev":"10-b238d82593104828cc474d322a50f578","name":"ready-callback","description":"Launch server after all async task ready","dist-tags":{"latest":"4.0.0"},"versions":{"1.0.0":{"name":"ready-callback","version":"1.0.0","description":"Launch server after all async task ready","keywords":["koa","ready","async"],"main":"index.js","files":["index.js","lib"],"dependencies":{"debug":"~2.2.0","extend":"~3.0.0","once":"~1.3.2","get-ready":"~1.0.0","uuid":"~2.0.1"},"devDependencies":{"istanbul":"0","eslint":"1","koa":"1","mocha":"1","should":"6","spy":"0"},"repository":{"type":"git","url":"git+https://github.com/node-modules/ready-callback.git"},"homepage":"https://github.com/node-modules/ready-callback","author":{"name":"popomore","email":"sakura9515@gmail.com"},"license":"MIT","scripts":{"lint":"eslint .","test":"mocha -R spec -t 20000","cov":"npm run lint && istanbul cover --report=none node_modules/mocha/bin/_mocha -- -R spec -t 20000 && istanbul report json html","autod":"autod -e test/fixtures -f ~ -w"},"engines":{"node":">=2.0.0"},"gitHead":"53e87742b3e6f5f2796343ec393851f76e5f7b2a","bugs":{"url":"https://github.com/node-modules/ready-callback/issues"},"_id":"ready-callback@1.0.0","_shasum":"d467e8f65b6cd218a8343f36a31f7024b750293d","_from":".","_npmVersion":"3.3.6","_nodeVersion":"4.2.1","_npmUser":{"name":"fengmk2","email":"fengmk2@gmail.com"},"maintainers":[{"name":"fengmk2","email":"fengmk2@gmail.com"}],"dist":{"shasum":"d467e8f65b6cd218a8343f36a31f7024b750293d","tarball":"https://registry.npmjs.org/ready-callback/-/ready-callback-1.0.0.tgz","integrity":"sha512-DzYOFa7RnpbgoMjtRoPWLxKmdoKQBk6/ajsseONrx0Zo6pnwRkWaCEL4NkD7eZbn+Og22gcct3sFReeHtMsLsQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICim8cQ8d2aSCbw6owo950awfM82Qh1pffHscdvKq45zAiBDHfsob6bTKJhKv/IHv+HsRtuwi/eSkRGRoVYlnu18sw=="}]},"directories":{}},"2.0.0":{"name":"ready-callback","version":"2.0.0","description":"Launch server after all async task ready","keywords":["koa","ready","async"],"main":"lib/ready.js","files":["index.js","lib"],"dependencies":{"debug":"^2.6.0","get-ready":"^2.0.0","once":"^1.4.0","uuid":"^3.0.1"},"devDependencies":{"autod":"^2.7.1","egg-bin":"^2.0.2","egg-ci":"^1.1.0","eslint":"^3.15.0","eslint-config-egg":"^3.2.0","koa":"^1.2.4","spy":"^1.0.0"},"repository":{"type":"git","url":"git+https://github.com/node-modules/ready-callback.git"},"homepage":"https://github.com/node-modules/ready-callback","author":{"name":"popomore","email":"sakura9515@gmail.com"},"license":"MIT","scripts":{"autod":"autod","lint":"eslint .","test":"npm run lint -- --fix && egg-bin test","cov":"egg-bin cov","ci":"npm run lint && egg-bin cov"},"engines":{"node":">=4.0.0"},"ci":{"version":"4, 6, 7"},"gitHead":"18efcbb05c25f9b8f9dc23d3714223793b8ae3fd","bugs":{"url":"https://github.com/node-modules/ready-callback/issues"},"_id":"ready-callback@2.0.0","_shasum":"20ec95a3965f4717bd8cd5434f57e7c79001bf95","_from":".","_npmVersion":"3.10.8","_nodeVersion":"6.9.1","_npmUser":{"name":"popomore","email":"sakura9515@gmail.com"},"dist":{"shasum":"20ec95a3965f4717bd8cd5434f57e7c79001bf95","tarball":"https://registry.npmjs.org/ready-callback/-/ready-callback-2.0.0.tgz","integrity":"sha512-sIu6SvQMy7uylO/ZH+ZvDN2ZkfTDZqjk95cLDZVMDy9mDw2rMwSpjEUB68aou/Uo8dvhgbKVFDUWtYcNTObFHw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFGvJwDqKEC2B8NLuo0XqF8wsio8hIEjbT9iqnP/uhqjAiAiuuN0qdycNXgfsvDbJ404/WfLI/c7cu9tCIcRMk+/TQ=="}]},"maintainers":[{"name":"fengmk2","email":"fengmk2@gmail.com"},{"name":"popomore","email":"sakura9515@gmail.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/ready-callback-2.0.0.tgz_1486648179711_0.8211493846029043"},"directories":{}},"2.0.1":{"name":"ready-callback","version":"2.0.1","description":"Launch server after all async task ready","keywords":["koa","ready","async"],"main":"lib/ready.js","files":["index.js","lib"],"dependencies":{"debug":"^2.6.0","get-ready":"^2.0.0","once":"^1.4.0","uuid":"^3.0.1"},"devDependencies":{"autod":"^2.7.1","egg-bin":"^2.0.2","egg-ci":"^1.1.0","eslint":"^3.15.0","eslint-config-egg":"^3.2.0","koa":"^1.2.4","spy":"^1.0.0"},"repository":{"type":"git","url":"git+https://github.com/node-modules/ready-callback.git"},"homepage":"https://github.com/node-modules/ready-callback","author":{"name":"popomore","email":"sakura9515@gmail.com"},"license":"MIT","scripts":{"autod":"autod","lint":"eslint .","test":"npm run lint -- --fix && egg-bin test","cov":"egg-bin cov","ci":"npm run lint && egg-bin cov"},"engines":{"node":">=4.0.0"},"ci":{"version":"4, 6, 7"},"gitHead":"ac54afad48a37e7e14df881812d90821ebc0b729","bugs":{"url":"https://github.com/node-modules/ready-callback/issues"},"_id":"ready-callback@2.0.1","_shasum":"579d972a2137a46c233cec5a013356bb45f2d046","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.9.5","_npmUser":{"name":"fengmk2","email":"fengmk2@gmail.com"},"dist":{"shasum":"579d972a2137a46c233cec5a013356bb45f2d046","tarball":"https://registry.npmjs.org/ready-callback/-/ready-callback-2.0.1.tgz","integrity":"sha512-nHzMjJ59bem0LAgSn5scgE/RE3ldT4TYC3AMvJ+wEOMbMxagfImXqz7friZ9NHGhM6C43eN5iBGm8gHYmH0Xqw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCTU02iRk21sJaxmUzk2q+5Y5uDYO49pLnT97tZX4oQFwIhAIfS+GstvFS8UeQHYNyHLYO0lfAdaiWXRu3YTfpSuSS/"}]},"maintainers":[{"name":"fengmk2","email":"fengmk2@gmail.com"},{"name":"popomore","email":"sakura9515@gmail.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/ready-callback-2.0.1.tgz_1486919656146_0.043568355264142156"},"directories":{}},"2.1.0":{"name":"ready-callback","version":"2.1.0","description":"Launch server after all async task ready","keywords":["koa","ready","async"],"main":"lib/ready.js","files":["index.js","lib"],"dependencies":{"debug":"^2.6.0","get-ready":"^2.0.0","once":"^1.4.0","uuid":"^3.0.1"},"devDependencies":{"autod":"^2.7.1","egg-bin":"^1.11.1","egg-ci":"^1.1.0","eslint":"^3.15.0","eslint-config-egg":"^3.2.0","koa":"^1.2.4","mz-modules":"^2.1.0","spy":"^1.0.0"},"repository":{"type":"git","url":"git+https://github.com/node-modules/ready-callback.git"},"homepage":"https://github.com/node-modules/ready-callback","author":{"name":"popomore","email":"sakura9515@gmail.com"},"license":"MIT","scripts":{"autod":"autod","lint":"eslint .","test":"npm run lint -- --fix && egg-bin test","cov":"egg-bin cov","ci":"npm run lint && egg-bin cov"},"engines":{"node":">=4.0.0"},"ci":{"version":"4, 6, 7"},"gitHead":"2a383cb24fe850e0e5d9d06db5773f563acbc7bb","bugs":{"url":"https://github.com/node-modules/ready-callback/issues"},"_id":"ready-callback@2.1.0","_npmVersion":"5.5.1","_nodeVersion":"8.4.0","_npmUser":{"name":"popomore","email":"sakura9515@gmail.com"},"dist":{"integrity":"sha512-pyoQjeks8RvkzHbdDgSS1Faw+3xByvnWxccsIiBLOtFX+sp6pkpdSuIZJzfIgpzpOSOdVFVxrFEL+VcNL3+bBQ==","shasum":"e382a9e33a568b8d771e04ef4ef0eb02d3dfa7e0","tarball":"https://registry.npmjs.org/ready-callback/-/ready-callback-2.1.0.tgz","fileCount":4,"unpackedSize":9459,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbe+saCRA9TVsSAnZWagAABL0P/1QTTOTluYAkkrNSRhoM\n8nGj4PfBDOwJ7D4JN89JzTvXXFJgzFyRhZsr2uzdHluJBqZPO6Ww6ba3j46g\nMq0Yi1Jmm5hPIeGHfznL0hU+TzDtqFphydYXtBgn9nVu9JBR/966vKmjSaRC\n54uNIe3RCL3THWI35l6UXEy8Jx7J60T+T0apmzuMmOE+KKtiLWMWga99nilB\n4sWESbCnspCQkc0ShagOg9hJabQClKTwByEs8SgD+dcgocbeV/G71Zvkzhai\nOirtAIz9pwEhI0l4afeAUSl47nL0x0DlnAauN2ldsSwlIKuGjjKj5Cw5jDfD\n43AMuQBnwy+esquKoy26w0imrujkwdA9rK+5NqRN/RvMAB5wOY427qGA85jv\nn0MV0nBjmDdyDRwYPYNz8KTprdcLXaP8Php823kShEfdeTUodrACqetmBSue\n6Ry0UQZj4lcuqc9O0pFTYFpiZiI8Rjvbm2eBO4j9xVMmDJsw9h4aaMmPAuec\nTncvyum2IPIxBlCGyGmfpJP9ulgEWvEbSVlkgUtvLpbTD0pmkB2nYUme4w7Z\npuwFcfP0YNHATeU5iZKmmzK4l+DWxQ4r+1+xJ0au3T3VFa57H3mADcp2mC6Y\nA/LOwp142S8GC619uYPb0MSA3AoaQBXcAX6zHBogpRACBxHxaaHnHM2GCgiC\nE5W7\r\n=jA8c\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCSxH8P8b7oQBcfGATdnd65NgKglypx4q1WXkjC5PnryAIgJFvnvu6i3G+YUu5ng40P08p6JzWsgTlxnECoWV2lPI8="}]},"maintainers":[{"name":"fengmk2","email":"fengmk2@gmail.com"},{"name":"popomore","email":"sakura9515@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ready-callback_2.1.0_1534847769959_0.22535173148050758"},"_hasShrinkwrap":false},"3.0.0":{"name":"ready-callback","version":"3.0.0","description":"Launch server after all async task ready","keywords":["koa","ready","async"],"main":"lib/ready.js","dependencies":{"debug":"^4.3.4","get-ready":"^2.0.1","once":"^1.4.0"},"devDependencies":{"egg-bin":"^5.9.0","eslint":"^8.31.0","eslint-config-egg":"^12.1.0","koa":"^1.2.4","spy":"^1.0.0"},"repository":{"type":"git","url":"git+https://github.com/node-modules/ready-callback.git"},"homepage":"https://github.com/node-modules/ready-callback","author":{"name":"popomore","email":"sakura9515@gmail.com"},"license":"MIT","scripts":{"lint":"eslint .","test":"npm run lint -- --fix && egg-bin test","cov":"egg-bin cov","ci":"npm run lint && egg-bin cov"},"engines":{"node":">=14.0.0"},"gitHead":"ab75e09d80ff776b293eba46b6e56795552be3ba","bugs":{"url":"https://github.com/node-modules/ready-callback/issues"},"_id":"ready-callback@3.0.0","_nodeVersion":"16.18.1","_npmVersion":"8.19.2","dist":{"integrity":"sha512-wGhjJMrxVEX35Ec+QlM2FW+ZsXhThNCbmdk+x22vzwRPPsDUNgq7C6nU0EpJRvNJSK/MiwQ73XZljo/IKhovXA==","shasum":"3430d540fdf1e92d30ce870645f2e03b70f38570","tarball":"https://registry.npmjs.org/ready-callback/-/ready-callback-3.0.0.tgz","fileCount":3,"unpackedSize":8081,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIA1pbQFG2STjNJ0AmRD1CErzawod7XJHYH7FvwX3/YuxAiAkd33g28olzL6Y46CWvxv91H79YACmNpKAqBn4RKxmAg=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjtC0GACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqV5hAAlnWnoOZE+whWZ3gL9oBFMoPirUkjw86pk48hcqY1tYxN164y\r\nai6Bi/edE77WMOSXcWx3So7SuiTAEJpOpczNJ9DiMxFG/YDUB4ZhpkwCgtYC\r\ngsPgAcki1zimSdPyDKmwjtlTDVLjfT+DoDPf9BlvD7uTw0YLZGCk0L29sB14\r\nI8P+7VCR/xSXSMRZ/5kvQQuwct1nuaL9J1InWGeqKZqxgPxtSxjUkMuXQAL1\r\n200CBfzmOm8jcvsOhbrF1iYakhtoH5rmd/AkzTTzw537jwA8meFXNDz93YKs\r\ntiJjKWnkgcYQ2pkS/aYOcX/g7+SvwB2tcVaVPdkMD8DbPnK+/wY/zNSdmHN8\r\nT48zzF3Akm9PSM5Qvz33YShsaaXlQnH5rewuhNRGkGNcqq7d69bdUsxODy9+\r\nr8IFVzCi3+VJwTVzPQHFX50csDuUrXHqYbYRSoRUYV7MTAh2AGmMyaGPanwf\r\nn0EV+ZbteNUeI+kZrlwhxlqR6ymL8ruKDO23hLGXFRml9hRlAsWyJwtg+WjC\r\nKA7PhTWRWBTxzkDG+TMUz+reDQglHzFrHJvyf/pT8hsyX+iv1I/c3xDYWFDf\r\nG7YfF6Ev29EdWW5k32Lw2FzLfh5kRolp5fortOyJHC6OVcZLAofVVcf8gx4J\r\nZ0vvL30hgQn4umZ9MMYLtjsRGwddDnYKqMg=\r\n=o7jy\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"fengmk2","email":"fengmk2@gmail.com"},"directories":{},"maintainers":[{"name":"fengmk2","email":"fengmk2@gmail.com"},{"name":"popomore","email":"sakura9515@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ready-callback_3.0.0_1672752390800_0.29913595617360755"},"_hasShrinkwrap":false},"4.0.0":{"name":"ready-callback","version":"4.0.0","description":"Launch server after all async task ready","keywords":["koa","ready","async"],"dependencies":{"get-ready":"^3.1.0","once":"^1.4.0"},"devDependencies":{"@eggjs/koa":"^2.15.1","@eggjs/tsconfig":"^1.3.3","@types/mocha":"^10.0.2","@types/node":"^20.8.3","@types/once":"^1.4.1","egg-bin":"^6.5.2","eslint":"^8.51.0","eslint-config-egg":"^12.3.1","git-contributor":"^2.1.5","mocha":"^10.2.0","tinyspy":"^2.2.0","ts-node":"^10.9.1","tshy":"^1.2.2","tshy-after":"^1.0.0","typescript":"^5.2.2"},"repository":{"type":"git","url":"git+https://github.com/node-modules/ready-callback.git"},"homepage":"https://github.com/node-modules/ready-callback","author":{"name":"popomore","email":"sakura9515@gmail.com"},"license":"MIT","scripts":{"test":"npm run lint -- --fix && egg-bin test","lint":"eslint src test --ext ts","ci":"npm run lint && egg-bin cov && npm run prepublishOnly","contributor":"git-contributor","prepublishOnly":"tshy && tshy-after"},"engines":{"node":">=16.0.0"},"ci":{"version":"16, 18, 20"},"tshy":{"exports":{".":"./src/index.ts"}},"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"}}},"type":"module","types":"./dist/commonjs/index.d.ts","_id":"ready-callback@4.0.0","gitHead":"91564dad6731b0204a41666232cec56119361f4a","bugs":{"url":"https://github.com/node-modules/ready-callback/issues"},"_nodeVersion":"18.18.0","_npmVersion":"9.8.1","dist":{"integrity":"sha512-4jkycmNcRk642rVKdYlqToVKoZ67TPWrOGCyvWYi074ZJli6J3cqr7L/IFtxqOrafrp05DReGzno6l/F7By7Dg==","shasum":"d7e489ba967be6ab40c09a67448d78ee44ddddf6","tarball":"https://registry.npmjs.org/ready-callback/-/ready-callback-4.0.0.tgz","fileCount":9,"unpackedSize":27881,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/ready-callback@4.0.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCQhMK8hzOxtPgJReA+hgGc0QWKYAYnMneEWzoQgCRzQAIgWSr3Z+eik5bLdpoiCwtvp6978suBis1IKiaaCvWd9NA="}]},"_npmUser":{"name":"fengmk2","email":"fengmk2@gmail.com"},"directories":{},"maintainers":[{"name":"fengmk2","email":"fengmk2@gmail.com"},{"name":"popomore","email":"sakura9515@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ready-callback_4.0.0_1696990413554_0.14411914191302455"},"_hasShrinkwrap":false}},"readme":"# ready-callback\n\n[![NPM version][npm-image]][npm-url]\n[![CI](https://github.com/node-modules/ready-callback/actions/workflows/ci.yml/badge.svg)](https://github.com/node-modules/ready-callback/actions/workflows/ci.yml)\n[![Test coverage][codecov-image]][codecov-url]\n[![npm download][download-image]][download-url]\n\n[npm-image]: https://img.shields.io/npm/v/ready-callback.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/ready-callback\n[codecov-image]: https://codecov.io/github/node-modules/ready-callback/coverage.svg?branch=master\n[codecov-url]: https://codecov.io/github/node-modules/ready-callback?branch=master\n[download-image]: https://img.shields.io/npm/dm/ready-callback.svg?style=flat-square\n[download-url]: https://npmjs.org/package/ready-callback\n\nLaunch server after all async task ready\n\n---\n\n## Install\n\n```bash\n$ npm install ready-callback\n```\n\n## Usage\n\n**Note: ready-callback is using `class`, so you should use node>=2**\n\n```js\nvar koa = require('koa');\nvar ready = require('ready-callback')();\nvar app = koa();\nready.mixin(app);\n\n// register a service\nvar done = app.readyCallback('service');\nserviceLaunch(done);\n\n// callback will be fired after all service launched\napp.ready(function() {\n  app.listen();\n});\n```\n\n### Error Handle\n\nIf task is called with error, `error` event will be emit, `ready` will never be called.\n\n```js\n// register a service that will emit error\nvar done = app.readyCallback('service');\nserviceLaunch(function(err) {\n  done(err);\n});\n\n// listen error event\napp.on('error', function(err) {\n  // catch error\n});\n```\n\n### Weak Dependency\n\nIf you set a task weak dependency, task will be done without emit `error`.\n\n```js\nvar done = app.readyCallback('service', {isWeakDep: true});\nserviceLaunch(function(err) {\n  done(err);\n});\n\n// will be ready\napp.ready(function() {\n  app.listen();\n});\n\napp.on('error', function(err) {\n  // never be called\n});\n```\n\nYou can also set for all ready-callback\n\n```js\nvar ready = require('ready-callback')({isWeakDep: true});\n```\n\n### Ready Status\n\nYou can get status every callback end.\n\n```js\napp.on('ready_stat', function(data) {\n  console.log(data.id); // id of the ended task\n  console.log(data.remain); // tasks waiting to be ended\n});\n```\n\n### Timeout\n\nYou can set timeout when a task run a long time.\n\n```js\nvar ready = require('ready-callback')({timeout: 1000});\nready.mixin(app);\napp.on('ready_timeout', function(id) {\n  // this will be called after 1s that `service` task don't complete\n});\n\nvar done = app.readyCallback('service');\nserviceLaunch(function() {\n  // run a long time\n  done();\n});\n```\n\nYou can also set timeout for every task\n\n```js\nready.mixin(app);\napp.on('ready_timeout', function(id) {\n  // this will be called after 1s that `service` task don't complete\n});\n\nvar done = app.readyCallback('service1', {timeout: 1000});\nserviceLaunch(done);\n```\n\n### lazyStart\n\nYou can set a ready-callback object to lazyStart. It will not check \nready status immediately, and should start manualy to check ready \nstatus.\n\n```js\nvar ready = require('ready-callback')({ lazyStart: true });\nyield sleep(1);\n// ready obj is not ready\nready.start();\nyield sleep(1);\n// ready obj is ready now\n```\n\n## LISENCE\n\nCopyright (c) 2015 popomore. Licensed under the MIT license.\n","maintainers":[{"name":"fengmk2","email":"fengmk2@gmail.com"},{"name":"popomore","email":"sakura9515@gmail.com"}],"time":{"modified":"2023-10-11T02:13:34.171Z","created":"2015-10-20T15:40:45.717Z","1.0.0":"2015-10-20T15:40:45.717Z","2.0.0":"2017-02-09T13:49:41.483Z","2.0.1":"2017-02-12T17:14:17.978Z","2.1.0":"2018-08-21T10:36:10.072Z","3.0.0":"2023-01-03T13:26:30.955Z","4.0.0":"2023-10-11T02:13:33.742Z"},"homepage":"https://github.com/node-modules/ready-callback","keywords":["koa","ready","async"],"repository":{"type":"git","url":"git+https://github.com/node-modules/ready-callback.git"},"author":{"name":"popomore","email":"sakura9515@gmail.com"},"bugs":{"url":"https://github.com/node-modules/ready-callback/issues"},"license":"MIT","readmeFilename":"README.md"}