staltz / xstream

An extremely intuitive, small, and fast functional reactive stream library for JavaScript
http://staltz.github.io/xstream/
MIT License
2.37k stars 137 forks source link

Consistent way to check if stream is MemoryStream #304

Open wclr opened 4 years ago

wclr commented 4 years ago

There is two methods I believe available now:

Check if instance of MemoryStream, not always applicable, as there may be problems with nested modules. Check if the object has property _has present, but it is just a hacky way.

Probably need to add a more consistent method that will be officially exposed.

staltz commented 4 years ago

I'm open to doing this (probably exposing a nice method that internally utilizes _has or something like that), but I'm curious what's your surrounding use case for this? I haven't done this check myself yet.

wclr commented 4 years ago

I'm implementing HMR for cyclejs components, so there I replicate (create proxy) streams and need to know if to create with memory or not.