Since Async Iteration is on the cusp of being available everywhere, the following dream code could become a reality:
async function (client) {
await client.subscribe("some/+/topic");
for await (let [topic, payload] of client) {
await saveToDB(topic, payload);
}
}
I propose we detect whether the environment has a Symbol.asyncIterator defined, and it it does, define a method for making the client async-iterable.
Since Async Iteration is on the cusp of being available everywhere, the following dream code could become a reality:
I propose we detect whether the environment has a
Symbol.asyncIteratordefined, and it it does, define a method for making the client async-iterable.