3 ms·
Even in Node I found the rx* libraries to be a bad abstraction and slow. I tend to just have my own observable stuff as I only want a small feature set in that
by winrid 3y ago
Even in Node I found the rx* libraries to be a bad abstraction and slow. I tend to just have my own observable stuff as I only want a small feature set in that regard anyway.
- porridgeraisin 3y agoYes same. I write myself a nice typed pipe() [2], and a one-after-the-other promise queue[4] whenever I need it but that's it really. I use web streams a lot. The most abstract I'm usually willing to get is using River [5] instead of array's map/filter/reduce. There seems to be an absolute obsession over these libraries now though. I assume it's fueled by every frontend library pushing functional patterns. See Effect [1] for example, it's insane how much is piled on. [1] https://effect.website https://effect.website [2] type Fun<A, B> = (a: A) => B export const pipe = <A, B>(f: Fun<A, B>) => { return { to: <C>(g: Fun<B, C>) => pipe((arg: A) => g(f(arg))), start: () => f, }; }; [4] class TaskQueue<U = any> { private pending: Promise<any> = Promise.resolve(); add = <T,>(task: () => Promise<false extends true & U ? T : U>) => (this.pending = this.pending.then(task).catch(task)); } [5] https://GitHub.com/wiselibs/river https://GitHub.com/wiselibs/river
- porridgeraisin 3y agocorrection: https://GitHub.com/wiselibs/wise-river https://GitHub.com/wiselibs/wise-river