event-emitter-async-iterator
TypeScript icon, indicating that this package has built-in type declarations

3.1.0 • Public • Published

Example

In GraphQL server subscription:

Subscription: {
	myCommand: {
		subscribe: (obj, args, context, info) => {

			const asyncIterator = new EventEmitterAsyncIterator();

			const pushMyCommand = (myCommand) => {
				asyncIterator.pushValue({
					myCommand: myCommand
				});
			};

			asyncIterator.once('return', () => {
				// The client has unsubscribed
			});

			return asyncIterator;
		}
	}
}

Readme

Keywords

none

Package Sidebar

Install

npm i event-emitter-async-iterator

Weekly Downloads

255

Version

3.1.0

License

MIT

Unpacked Size

13.3 kB

Total Files

9

Last publish

Collaborators

  • johnvmt