{"name":"async-stream-emitter","version":"7.0.0","description":"An alternantive to EventEmitter using consumable streams.","main":"index.js","scripts":{"build":"rollup --config ./rollup.config.js","test":"./node_modules/mocha/bin/_mocha --reporter spec --timeout 10000 --slow 10000"},"repository":{"type":"git","url":"git+https://github.com/SocketCluster/async-stream-emitter.git"},"keywords":["iterable","async","stream","event","emitter","for-await-of"],"author":{"name":"Jonathan Gros-Dubois"},"license":"MIT","bugs":{"url":"https://github.com/SocketCluster/async-stream-emitter/issues"},"homepage":"https://github.com/SocketCluster/async-stream-emitter#readme","devDependencies":{"@rollup/plugin-commonjs":"^25.0.4","@rollup/plugin-node-resolve":"^15.2.1","@rollup/plugin-terser":"^0.4.3","mocha":"^10.2.0","rollup":"^3.28.1"},"dependencies":{"stream-demux":"^10.0.0"},"gitHead":"d6ead7db31e3e95524157769019408f3ccdd5aee","_id":"async-stream-emitter@7.0.0","_nodeVersion":"16.16.0","_npmVersion":"8.17.0","dist":{"integrity":"sha512-zBGSAshLTDJBy5uw9z2azNwN9yXpzD1JUGXCd/6l00GKzKsYSrm06H1HBPDCmK5f/8uctY1/e69vFjlfS+rN5Q==","shasum":"572a51a3347bdca55d748e80f50b16f0a94235aa","tarball":"http://registry-npm.ywwl.com/async-stream-emitter/download/async-stream-emitter-7.0.0.tgz","fileCount":8,"unpackedSize":18477,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDZyo4H8abXozo1ZOo7R8rKWguCuxAgZmcZkwt95wL3PAiEAiKUNCRc4tG15rvWHxaFkGhKhEOVC/VbVHQYCHpR9Lx4="}],"size":4993,"noattachment":false,"key":"/async-stream-emitter/-/async-stream-emitter-7.0.0.tgz"},"_npmUser":{"name":"topcloudsystems","email":"grosjona@yahoo.com.au"},"directories":{},"maintainers":[{"name":"topcloudsystems","email":"grosjona@yahoo.com.au"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/async-stream-emitter_7.0.0_1697818675776_0.17679689779570595"},"_hasShrinkwrap":false,"readme":"# async-stream-emitter\nEventEmitter using ConsumableStream.\n\n## Main methods:\n\n- emit(eventName, data)\n- listener(eventName)\n- closeListener(eventName)\n- closeAllListeners()\n- killListener(eventName)\n- killAllListeners()\n- getListenerBackpressure(eventName)\n- getAllListenersBackpressure()\n\n## Usage examples\n\n```js\nlet emitter = new AsyncStreamEmitter();\n\n(async () => {\n  await wait(10);\n  emitter.emit('foo', 'hello');\n\n  // This will cause all for-await-of loops for that event to exit.\n  // Note that you can also use the 'break' statement inside\n  // individual for-await-of loops.\n  emitter.closeListener('foo');\n})();\n\n(async () => {\n  for await (let data of emitter.listener('foo')) {\n    // data is 'hello'\n  }\n  console.log('The listener was closed.');\n})();\n\n// Utility function.\nfunction wait(duration) {\n  return new Promise((resolve) => {\n    setTimeout(() => {\n      resolve();\n    }, duration);\n  });\n}\n```\n","publish_time":1697818675954,"_cnpm_publish_time":1697818675954,"dist-tags":{"latest":"7.1.1"}}