{"_id":"p-all-runner","_rev":"4-fc3254a19a9dc6abe4f537c590d726dd","name":"p-all-runner","dist-tags":{"latest":"0.0.2"},"versions":{"0.0.1":{"name":"p-all-runner","description":"Async function runner to remove the ugly IIFE","version":"0.0.1","main":"dist/index.js","license":"MIT","author":{"name":"skt-t1-byungi","email":"tiniwz@gmail.com"},"repository":{"type":"git","url":"https://github.com/skt-t1-byungi/p-all-runner.git"},"keywords":["promise","async","await","sync","runner","pool"],"files":["dist/"],"scripts":{"build":"tsc -d","test":"tsc && ava dist/test.js","prepublishOnly":"npm run build"},"eslintConfig":{"extends":"byungi"},"devDependencies":{"ava":"^0.25.0","tslint":"^5.10.0","tslint-config-byungi":"^0.0.4","typescript":"^2.8.3"},"_id":"p-all-runner@0.0.1","dist":{"shasum":"c187352a37423d999d5c8020529c5b4d40aceedf","tarball":"https://registry.npmjs.org/p-all-runner/-/p-all-runner-0.0.1.tgz","fileCount":8,"unpackedSize":14826,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbBDWrCRA9TVsSAnZWagAAkf8QAKQpuzE4C+9i5ZCUJCEC\nVQnbiImBmjLOGCekseQsimsQF4vT5eXMs6Q4d6vcxf0Yqb9iUzd7h9tCFRrJ\nBmhKJNoTtaB4ZvwbeizXJ1YRWqYLVvzYv5AT7oIG9HmBJrCdbSWDzUDP+m2R\ne9thDLJjqzVRW+ja5VfOlP7Jjhrq0IwIHVAXfE7OJrjmWk1ubRdFS7PkMQhs\nuo9zfia9eExFNfE306M6EsszviTRoUX+q5GAdYtfs0DxjlnaC6Nl9LTfaJsJ\nec4g+RV+c85IutTGse1yQQibqyU5f4tTu2IcEGfmucSSkWC4RTQ4hTz7IPk0\ndE5e/V0OshfEKKS1ri4Q17wRrrur7IrwWwpSfzWiGibjm+a/xVdLDVlsp/HT\n2lr5SlwHKIqywAAE+M4XZRme592sOy9aqWHqmswT3QSN+n5B+RsSO7uUIwg7\n3ZQ/WIxdnovmWjmpZIX7U1z0ThWs1eWvklPYmICiicu+HNSf65tKnpfw0wBh\nX3uLOfDI6PfHhH1jt/JvGadCqC9oSHUThyKVuIA74OuAnXXBLrm1vY5kUjZ3\nHDmrECOBFQC8mYZveYiwxFNEFNs2qpL7YXhASoai8ysVT3kjp0wdMsWA1PlS\nueIrOUY9c8btEk2ZKEELNy3zZ/Ya45OvdKaxrBbX2VdunHl3HKcp5g9pWFnz\nAi0+\r\n=zFVP\r\n-----END PGP SIGNATURE-----\r\n","integrity":"sha512-a2ise2NprnmlRB0eBoqftnLYAPmQSHmoXe7pSaHQpoCelXNYyAwI3kcA5mNdFg3T95iPfAaJbM63BPtgTLQRbQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFwn5+sfP1Eaq5aykRvz5kbCMPe1+AWONkvzgh7ZFXAEAiBvcKZKDm0UWuWoUXnmk/tCU/jJzlDRnaQm6WgAssasuA=="}]},"maintainers":[{"name":"skt-t1-byungi","email":"tiniwz@gmail.com"}],"_npmUser":{"name":"skt-t1-byungi","email":"tiniwz@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/p-all-runner_0.0.1_1527002538029_0.5966696414353547"},"_hasShrinkwrap":false},"0.0.2":{"name":"p-all-runner","description":"Async function runner to remove the ugly IIFE","version":"0.0.2","main":"dist/index.js","license":"MIT","author":{"name":"skt-t1-byungi","email":"tiniwz@gmail.com"},"repository":{"type":"git","url":"git+https://github.com/skt-t1-byungi/p-all-runner.git"},"keywords":["promise","async","await","sync","runner","pool"],"files":["dist"],"scripts":{"build":"tsc -d","test":"tsc && ava dist/test.js","prepublishOnly":"npm run build"},"eslintConfig":{"extends":"byungi"},"devDependencies":{"ava":"^0.25.0","tslint":"^5.10.0","tslint-config-byungi":"^0.0.4","typescript":"^2.8.3"},"gitHead":"c20f03413eff9847b986241c149c8b0f97f75920","bugs":{"url":"https://github.com/skt-t1-byungi/p-all-runner/issues"},"homepage":"https://github.com/skt-t1-byungi/p-all-runner#readme","_id":"p-all-runner@0.0.2","_npmVersion":"6.0.1","_nodeVersion":"9.10.1","_npmUser":{"name":"skt-t1-byungi","email":"tiniwz@gmail.com"},"dist":{"integrity":"sha512-vJ/cTzd81muAFlxDlOQ/xHfOIeFK0UHunqlA+yfJJ7Mzj7hhlLgz2KyV7iqrF0ku0plAPQ3uHigmSFu8R8SVpw==","shasum":"b803f2fc1c77ed803b6cbce2afe45da0d8e1bddd","tarball":"https://registry.npmjs.org/p-all-runner/-/p-all-runner-0.0.2.tgz","fileCount":6,"unpackedSize":14825,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbBDhFCRA9TVsSAnZWagAAlYYP/3QiT0z4wUv9rQxO+Z1S\nnoLjM41cCYfu9Xnudq7BNJH7NWcuHKd0UWDqIFDAeN1BPeA3GhXIhUGww2l1\nV7eacjJKOmlBBFU8FA/v000+Zx3LfWF8q8tnsVTQLS9OJI33HLkr3+X1DamH\nXOHZqYSWm5Z82YaimX2xEW8trf53OvJ63z4yKNMo9sxtYNsqP0+EiNs//uIf\n721kOVGFWd6c5JeOWwChR7Nj7j5eWPHYdSRndSLrmiu0SsYuySLnEUDCl5lx\ncww25807+6LSJds0S7qcPV8WTqvTlXke+0t/RLaNdBOgQjgYJAlk/Vbhjl+Y\nj2KEnwuX2WKLtx8QGnrcou4mlV+Cf/LPvzmX64KhniNoHSOqHk7q1G2B/Iht\nU+BbdzXXNjIvL6pPJ/rlML7GNv+Bvg4PyQuXY8HWK4KASKfU4CVQQr+VVva1\nzlXgtiIWAW3EKNrA92MO/3lOC9MZre921jEE6qdJJT6jjGvnn7LejyJt6mSW\nxkfRxKUSz3d8jyd554aLKN+bk+KOzMhSIPO/jEgxn+i0zwqrzk9rTvpsA1NS\nnBPGt7fH9y3vfcAw/B8zYevMCcRsqVO7IOX+47P/bOgzx/IPs2pGg3B3uL1T\nQdX7eqsW0WHxb1OR+ak/zhSBaOzMnb5gQOmxEMocY61o2wfGMVuhf5cWQu10\nW2V+\r\n=1C82\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAaR9bQlbEwsdB+s83Z0yykMQr/3M4dfUnNbdaeEWHlvAiEA0PfDvRnnhIUhxLcUh+Q5hRIlXwLR1075kl1ntSsP4xE="}]},"maintainers":[{"name":"skt-t1-byungi","email":"tiniwz@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/p-all-runner_0.0.2_1527003204964_0.8999318553315887"},"_hasShrinkwrap":false}},"time":{"created":"2018-05-22T15:22:18.029Z","0.0.1":"2018-05-22T15:22:18.131Z","modified":"2022-06-23T05:42:00.529Z","0.0.2":"2018-05-22T15:33:25.035Z"},"maintainers":[{"name":"skt-t1-byungi","email":"tiniwz@gmail.com"}],"description":"Async function runner to remove the ugly IIFE","keywords":["promise","async","await","sync","runner","pool"],"repository":{"type":"git","url":"git+https://github.com/skt-t1-byungi/p-all-runner.git"},"author":{"name":"skt-t1-byungi","email":"tiniwz@gmail.com"},"license":"MIT","readme":"# p-all-runner\r\nAsync function runner to remove the ugly IIFE\r\n\r\n[![npm](https://img.shields.io/npm/v/p-all-runner.svg?style=flat-square)](https://www.npmjs.com/package/p-all-runner)\r\n\r\n\r\n## Install\r\n```sh\r\nyarn add p-all-runner\r\n```\r\n\r\n```js\r\n//esm\r\nimport runner from \"p-all-runner\";\r\n\r\n//commonjs\r\nconst {runner} = require('p-all-runner');\r\n```\r\n\r\n### What?\r\n```js\r\n(async () => {\r\n  const concurrentTasks = []\r\n\r\n  concurrentTasks.push(\r\n    (async()=>{ \r\n      await asyncTask1()\r\n    })(),\r\n    (async()=>{\r\n      await asyncTask2()\r\n    })()\r\n  )\r\n\r\n  await Promise.all(concurrentTasks)\r\n})()\r\n```\r\nEven within the async function there are concurrent tasks that do not \"await\" immediately. If write concurrent task with async function, need ugly IIFE.\r\n\r\n```js\r\n(async () => {\r\n  const pool = runner() \r\n\r\n  pool.add(\r\n    async()=>{ \r\n      await asyncTask1()\r\n    },\r\n    async()=>{\r\n      await asyncTask2()\r\n    }\r\n  )\r\n\r\n  await pool.wait()\r\n})()\r\n```\r\nThe p-all-runner calls the async function instead to remove the IIFE.\r\n\r\n### API\r\n#### Runner\r\nCreate an runner(pool) instance.\r\n\r\n```js\r\nconst pool = runner()\r\n// or \r\nimport {Runner} from \"p-all-runner\"\r\nconst pool = new Runner()\r\n```\r\n\r\n#### pool.add(awaitable)\r\nAdd an async function to run immediately. it is possible to add promise or p-all-runner instance instead of async function.\r\n\r\n```js\r\npool.add(\r\n  async()=>{\r\n    await asyncTask1()\r\n    await asyncTask2()\r\n  },\r\n  asyncTask3() //returns promise.\r\n)\r\npool.add(otherPool) \r\n```\r\n\r\n#### pool.defer(act)\r\nRun async function when `pool.wait()` is called. This is useful when using other p-all-runner instance together.\r\n\r\n```js\r\npool.defer(async()=>{\r\n  await asyncTask1()\r\n})\r\nawait pool.wait()\r\n\r\n// using other instance together\r\npool.defer(otherPool)\r\notherPool.add(()=> asyncTask())\r\nawait pool.wait()\r\n```\r\n\r\n#### pool.wait([opts])\r\nReturns `promise.all()` for the added async functions.\r\n\r\n##### opts\r\n###### silent\r\nIf true, it returns null without throwing an error. defaults `false`.\r\n\r\n### License\r\nMIT","readmeFilename":"README.md","homepage":"https://github.com/skt-t1-byungi/p-all-runner#readme","bugs":{"url":"https://github.com/skt-t1-byungi/p-all-runner/issues"}}