Alternatives to ZenObservable

Hey there,

Some time back there was talk of swapping out the observable implementation to something that uses async iterables, a web platform feature, in order to decrease bundle sizes.

I found this library that does something similar using WHATWG streams and thought it might provide a good starting point for discussions.

Cheers

Justin Fagnani published this one as well async-broadcaster - npm

The great thing about either of these options: producing a Stream or an async iterable - is that by using a platform API for consuming data they decouple the implementation. So not only are the implementations above small now, but however you produce the stream/iterable can change without changing the consumption sites.

I personally really appreciated being able to do this at the subscription site, rather than use a subscribe() API:

for await (const data of updates) {
  doSomething(data);
}

Hi Justin thanks for dropping by. Do you think either or these could suit a drop in replacement?

specifically, I’m thinking about the nextData and nextError- type callbacks, e.g. to the query subscription.