{"_id":"await-event","_rev":"3018715","name":"await-event","description":"yield an event with generators","dist-tags":{"latest":"2.1.0"},"maintainers":[{"name":"coderhaoxin","email":""},{"name":"dead_horse","email":"dead_horse@qq.com"},{"name":"fengmk2","email":"fengmk2@gmail.com"},{"name":"jongleberry","email":"jonathanrichardong@gmail.com"}],"time":{"modified":"2023-11-07T03:46:51.000Z","created":"2014-04-24T22:15:32.022Z","2.1.0":"2017-03-24T02:31:13.223Z","2.0.0":"2017-02-16T09:57:00.715Z","1.0.0":"2014-04-24T22:15:32.022Z"},"users":{"hoitmort":true},"author":{"name":"Jonathan Ong","email":"me@jongleberry.com","url":"http://jongleberry.com"},"repository":{"type":"git","url":"git+https://github.com/cojs/await-event.git"},"versions":{"2.1.0":{"name":"await-event","description":"yield an event with generators","version":"2.1.0","author":{"name":"Jonathan Ong","email":"me@jongleberry.com","url":"http://jongleberry.com"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/cojs/await-event.git"},"keywords":["co","events","event-emitter","await"],"scripts":{"test":"jest --forceExit","test-cov":"jest --coverage --forceExit"},"devDependencies":{"co":"^4.6.0","jest":"^18.1.0"},"jest":{"testEnvironment":"node"},"files":["index.js"],"gitHead":"80ce58e5961888b9e225b9a36974f14509d0b68a","bugs":{"url":"https://github.com/cojs/await-event/issues"},"homepage":"https://github.com/cojs/await-event#readme","_id":"await-event@2.1.0","_shasum":"78e9f92684bae4022f9fa0b5f314a11550f9aa76","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"dead_horse","email":"dead_horse@qq.com"},"dist":{"shasum":"78e9f92684bae4022f9fa0b5f314a11550f9aa76","size":1836,"noattachment":false,"key":"/await-event/-/await-event-2.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/await-event/download/await-event-2.1.0.tgz"},"maintainers":[{"name":"coderhaoxin","email":""},{"name":"dead_horse","email":"dead_horse@qq.com"},{"name":"fengmk2","email":"fengmk2@gmail.com"},{"name":"jongleberry","email":"jonathanrichardong@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/await-event-2.1.0.tgz_1490322672995_0.20973455882631242"},"directories":{},"publish_time":1490322673223,"_hasShrinkwrap":false,"_cnpm_publish_time":1490322673223,"_cnpmcore_publish_time":"2021-12-14T02:25:51.699Z"},"2.0.0":{"name":"await-event","description":"yield an event with generators","version":"2.0.0","author":{"name":"Jonathan Ong","email":"me@jongleberry.com","url":"http://jongleberry.com"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/cojs/await-event.git"},"keywords":["co","events","event-emitter","await"],"scripts":{"test":"jest --forceExit","test-cov":"jest --coverage --forceExit"},"devDependencies":{"co":"^4.6.0","jest":"^18.1.0"},"jest":{"testEnvironment":"node"},"files":["index.js"],"gitHead":"89bd3fbcdeced068cc49a8e07d7e2a654c9fd320","bugs":{"url":"https://github.com/cojs/await-event/issues"},"homepage":"https://github.com/cojs/await-event#readme","_id":"await-event@2.0.0","_shasum":"67a56cac2089c258e1b0b90bd224e18f997a1dcb","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.9.5","_npmUser":{"name":"fengmk2","email":"fengmk2@gmail.com"},"dist":{"shasum":"67a56cac2089c258e1b0b90bd224e18f997a1dcb","size":1623,"noattachment":false,"key":"/await-event/-/await-event-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/await-event/download/await-event-2.0.0.tgz"},"maintainers":[{"name":"coderhaoxin","email":""},{"name":"dead_horse","email":"dead_horse@qq.com"},{"name":"fengmk2","email":"fengmk2@gmail.com"},{"name":"jongleberry","email":"jonathanrichardong@gmail.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/await-event-2.0.0.tgz_1487239018801_0.4325683661736548"},"directories":{},"publish_time":1487239020715,"_cnpm_publish_time":1487239020715,"_hasShrinkwrap":false},"1.0.0":{"name":"await-event","description":"yield an event with generators","version":"1.0.0","author":{"name":"Jonathan Ong","email":"me@jongleberry.com","url":"http://jongleberry.com"},"license":"MIT","repository":{"type":"git","url":"git://github.com/cojs/await-event"},"keywords":["co","events","event-emitter","await"],"bugs":{"url":"https://github.com/cojs/await-event/issues"},"homepage":"https://github.com/cojs/await-event","_id":"await-event@1.0.0","dist":{"shasum":"0ab6960f5907d2a5d41bd851896748c054625e84","size":1795,"noattachment":false,"key":"/await-event/-/await-event-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/await-event/download/await-event-1.0.0.tgz"},"_from":".","_npmVersion":"1.4.6","_npmUser":{"name":"jongleberry","email":"jonathanrichardong@gmail.com"},"maintainers":[{"name":"coderhaoxin","email":""},{"name":"dead_horse","email":"dead_horse@qq.com"},{"name":"fengmk2","email":"fengmk2@gmail.com"},{"name":"jongleberry","email":"jonathanrichardong@gmail.com"}],"directories":{},"publish_time":1398377732022,"_cnpm_publish_time":1398377732022,"_hasShrinkwrap":false}},"readme":"# Await Event\n\nA really stupid utility I use frequently for event emitters.\nAllows you to `yield` an event and return the results.\nI use this a lot of locking.\n\nNote: you probably shouldn't use this for the `error` event.\n\n## Example\n\n```js\nvar PassThrough = require('stream').PassThrough\n\nvar stream = new PassThrough()\n// you attach it directly on an event emitter\nstream.await = require('await-event')\n\nco(function* () {\n  var chunk = yield stream.await('data')\n  var chunk = yield stream.await('data')\n  var chunk = yield stream.await('data')\n}).catch(noop)\n\nstream.write('some chunk')\n```\n\nYou can use awaitEvent without attach on an event emitter:\n\n```js\nvar EventEmitter = require('event')\n\nvar emitter = new EventEmitter()\nco(function*() {\n  yield awaitEvent(emitter, 'ready')\n}).catch(noop)\n```\n\nWhen use this for `error` event, it will reject once `error` event emitted:\n\n```js\nvar EventEmitter = require('event')\n\nvar emitter = new EventEmitter()\nco(function*() {\n  // it will throw when `error` event emitted\n  yield awaitEvent(emitter, 'error')\n}).catch(err => console.error(err.stack))\n```\n","_attachments":{},"homepage":"https://github.com/cojs/await-event#readme","bugs":{"url":"https://github.com/cojs/await-event/issues"},"license":"MIT"}