karet icon indicating copy to clipboard operation
karet copied to clipboard

Accept ES7 Observables instead of Kefir

Open fiatjaf opened this issue 7 years ago • 3 comments

I know this library is specially modelled for Kefir streams, hence its name, but I think it would be great if any reactive streams library could be used (I personally like https://github.com/staltz/xstream, although Kefir looks great for my use-case), maybe using a different name and a different repository.

I've come up with the following changes: https://github.com/calmm-js/karet/compare/master...fiatjaf:b460d77fa8b38188e8003dc3de90bf161dc89d67

But they don't pass the tests (I've used xstream on the tests instead of Kefir), so I'm looking for help.

fiatjaf avatar Jun 14 '17 23:06 fiatjaf

I think I got it right here: https://github.com/fiatjaf/oaret

fiatjaf avatar Jun 15 '17 17:06 fiatjaf

I took a very quick look and it seems roughly right. 👍 There might be some corner cases to consider due to Kefir (and Bacon) having different semantics from those of ES7 observables in case of errors.

IIRC, @rikutiira was also interested in an ES7 observable port.

I noticed that you didn't port fromKaret? That is actually very nice to have every now and then. So I'd recommend porting it, too.

Also, you switched to using legacy CommonJS modules. Note that having the ES2015 style modules and a module entry point in package.json helps modern bundlers and UglifyJS to do a better job at dead code elimination. In fact, with Rollup, ES2015 modules, UglifyJS /*#__PURE__*/ annotations and FP style code, dead code elimination can be very effective.

BTW, did you notice the Gitter room?

polytypic avatar Jun 15 '17 19:06 polytypic

I tried to keep the whole boilerplate, but I gave up when nyc (I guess it was this thing) started crashing my computer and leaving hanging processes whenever I ran the tests.

I also don't like the idea of having to compile the code before running the tests. I know you're right about ES modules and Rollup, since I recently read on that topic and got convinced, but I did what I did on a burst of irrational rage against nyc and babel.

In the long run I think I will bring back some things I've just deleted, yes, but now I just want to build the project I left hanging for a month while I searched for a library like karet (which I didn't know if existed).

fiatjaf avatar Jun 15 '17 19:06 fiatjaf