{"_id":"await-event","_rev":"15-559e5785b50ba2f166be52e7d1d75294","name":"await-event","dist-tags":{"latest":"2.1.0"},"versions":{"1.0.0":{"name":"await-event","version":"1.0.0","keywords":["co","events","event-emitter","await"],"author":{"url":"http://jongleberry.com","name":"Jonathan Ong","email":"me@jongleberry.com"},"license":"MIT","_id":"await-event@1.0.0","maintainers":[{"name":"jongleberry","email":"jonathanrichardong@gmail.com"}],"homepage":"https://github.com/cojs/await-event","bugs":{"url":"https://github.com/cojs/await-event/issues"},"dist":{"shasum":"0ab6960f5907d2a5d41bd851896748c054625e84","tarball":"https://registry.npmjs.org/await-event/-/await-event-1.0.0.tgz","integrity":"sha512-/0cl+D/5HgtfiXQGkKy35jqE5IdbWl/aTCKOl+7XC7sb1eTLJLuWAqKsOZzN8F3RfsHZ0YZ6UV8PiG6sJxb7wQ==","signatures":[{"sig":"MEUCIQCfROtVv0wr0LU2sAieiHNL3VRAPvxfQg37aG0PBa2q5wIgFsRZHSxo+euSFrLyVl8OtDJJ+NbfHCzCkSptRPFInrA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"_from":".","_npmUser":{"name":"jongleberry","email":"jonathanrichardong@gmail.com"},"repository":{"url":"git://github.com/cojs/await-event","type":"git"},"_npmVersion":"1.4.6","description":"yield an event with generators","directories":{}},"2.0.0":{"name":"await-event","version":"2.0.0","keywords":["co","events","event-emitter","await"],"author":{"url":"http://jongleberry.com","name":"Jonathan Ong","email":"me@jongleberry.com"},"license":"MIT","_id":"await-event@2.0.0","maintainers":[{"name":"coderhaoxin","email":"haoxins@outlook.com"},{"name":"fengmk2","email":"fengmk2@gmail.com"},{"name":"jongleberry","email":"jonathanrichardong@gmail.com"}],"homepage":"https://github.com/cojs/await-event#readme","bugs":{"url":"https://github.com/cojs/await-event/issues"},"dist":{"shasum":"67a56cac2089c258e1b0b90bd224e18f997a1dcb","tarball":"https://registry.npmjs.org/await-event/-/await-event-2.0.0.tgz","integrity":"sha512-soy0E+VRkMFUCHXUNxizLFzr5Zl0DV/7V94hTCO38U2EpvhcX9aNsCRyuW3oCqc2cSLxZm7w0ZF9qEAxS5tpWw==","signatures":[{"sig":"MEUCIB/wAdX6uliWa3dOV86XZqtFDOzcFHjG53bgZDn8aAAoAiEAv2q8aOIl5Q/bh33ALSP92HMwG9hQ2s2F680Uli4VpHY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"jest":{"testEnvironment":"node"},"_from":".","files":["index.js"],"_shasum":"67a56cac2089c258e1b0b90bd224e18f997a1dcb","gitHead":"89bd3fbcdeced068cc49a8e07d7e2a654c9fd320","scripts":{"test":"jest --forceExit","test-cov":"jest --coverage --forceExit"},"_npmUser":{"name":"fengmk2","email":"fengmk2@gmail.com"},"repository":{"url":"git+https://github.com/cojs/await-event.git","type":"git"},"_npmVersion":"3.10.10","description":"yield an event with generators","_nodeVersion":"6.9.5","devDependencies":{"co":"^4.6.0","jest":"^18.1.0"},"_npmOperationalInternal":{"tmp":"tmp/await-event-2.0.0.tgz_1487239018801_0.4325683661736548","host":"packages-18-east.internal.npmjs.com"},"directories":{}},"2.1.0":{"name":"await-event","version":"2.1.0","keywords":["co","events","event-emitter","await"],"author":{"url":"http://jongleberry.com","name":"Jonathan Ong","email":"me@jongleberry.com"},"license":"MIT","_id":"await-event@2.1.0","maintainers":[{"name":"coderhaoxin","email":"haoxins@outlook.com"},{"name":"dead-horse","email":"dead_horse@qq.com"},{"name":"dead_horse","email":"dead_horse@qq.com"},{"name":"fengmk2","email":"fengmk2@gmail.com"},{"name":"jongleberry","email":"jonathanrichardong@gmail.com"}],"homepage":"https://github.com/cojs/await-event#readme","bugs":{"url":"https://github.com/cojs/await-event/issues"},"dist":{"shasum":"78e9f92684bae4022f9fa0b5f314a11550f9aa76","tarball":"https://registry.npmjs.org/await-event/-/await-event-2.1.0.tgz","integrity":"sha512-hADm2dFnyugZnfFoJ0Oug2T9xAT2gFdvxZXXnWUOFsHL+VTCvj4Q7oBOinUYzvAFeAD5HN1YSrP78iS3/SQ7iQ==","signatures":[{"sig":"MEYCIQD1jirPyVObK0sBoeqPtwo4m71ZwzpOKGn4Y/W4x9aYOAIhAOgnf8OUwGKboWWzwM6FpvA/NhNigsM/iLzhc8Xqyd3u","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"jest":{"testEnvironment":"node"},"_from":".","files":["index.js"],"_shasum":"78e9f92684bae4022f9fa0b5f314a11550f9aa76","gitHead":"80ce58e5961888b9e225b9a36974f14509d0b68a","scripts":{"test":"jest --forceExit","test-cov":"jest --coverage --forceExit"},"_npmUser":{"name":"dead_horse","email":"dead_horse@qq.com"},"repository":{"url":"git+https://github.com/cojs/await-event.git","type":"git"},"_npmVersion":"4.1.2","description":"yield an event with generators","_nodeVersion":"7.6.0","devDependencies":{"co":"^4.6.0","jest":"^18.1.0"},"_npmOperationalInternal":{"tmp":"tmp/await-event-2.1.0.tgz_1490322672995_0.20973455882631242","host":"packages-12-west.internal.npmjs.com"},"directories":{}}},"time":{"created":"2014-04-24T22:15:32.022Z","modified":"2025-08-30T02:47:50.339Z","1.0.0":"2014-04-24T22:15:32.022Z","2.0.0":"2017-02-16T09:57:00.715Z","2.1.0":"2017-03-24T02:31:13.223Z"},"bugs":{"url":"https://github.com/cojs/await-event/issues"},"author":{"url":"http://jongleberry.com","name":"Jonathan Ong","email":"me@jongleberry.com"},"license":"MIT","homepage":"https://github.com/cojs/await-event#readme","keywords":["co","events","event-emitter","await"],"repository":{"url":"git+https://github.com/cojs/await-event.git","type":"git"},"description":"yield an event with generators","maintainers":[{"email":"haoxinst@gmail.com","name":"coderhaoxin"},{"email":"dead_horse@qq.com","name":"dead_horse"},{"email":"jonathanrichardong@gmail.com","name":"jongleberry"},{"email":"fengmk2@gmail.com","name":"fengmk2"}],"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","readmeFilename":"README.md"}