{"name":"async-stream-emitter","version":"7.0.1","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.1"},"gitHead":"0bea0e73f4e9b93036cca6d7126d13b7854642cf","_id":"async-stream-emitter@7.0.1","_nodeVersion":"16.16.0","_npmVersion":"8.17.0","dist":{"integrity":"sha512-1bgA3iZ80rCBX2LocvsyZPy0QB3/xM+CsXBze2HDHLmshOqx2JlAANGq23djaJ48e9fpcKzTzS1QM0hAKKI0UQ==","shasum":"c01832cddcc8f07d8ed528347803ec1517f8886d","tarball":"http://registry-npm.ywwl.com/async-stream-emitter/download/async-stream-emitter-7.0.1.tgz","fileCount":8,"unpackedSize":18477,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCqW5cOyNk8n7tcqES9KylWQpTjnm8BwK4ywCt/0VTohgIhAPPEzXSiUEEqwF2bW/mmwb8tTpTchpgzmfN+tPWEdwBJ"}],"size":4993,"noattachment":false,"key":"/async-stream-emitter/-/async-stream-emitter-7.0.1.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.1_1697819471781_0.7533083047386908"},"_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":1697819472036,"_cnpm_publish_time":1697819472036,"dist-tags":{"latest":"7.1.1"}}