An experiment I made to learn async iterators added in Node.js v10.0.0
. It allows an implementer to create a channel consumers can subscribe to (like observables or events) and use for await
syntax instead of callbacks.
Given that there are existing mature APIs and libraries that fit this use case, don't use this in your codebase. Instead, take a look at:
- ES observables
- RxJS observables
- Node.js streams which got stable async interators in Node.js
v11.14.0
- Node.js EventEmmiters
- Or just use callbacks 😜