ruby.social is one of the many independent Mastodon servers you can use to participate in the fediverse.
If you are interested in the Ruby programming language, come join us! Tell us about yourself when signing up. If you just want to join Mastodon, another server will be a better place for you.

Administered by:

Server stats:

1.1K
active users

#rxjs

0 posts0 participants0 posts today

I've been pondering about creating EventSourcing, CQRS & DDD scaffolding from scratch in TypeScript.

There doesn't seem to be an OpenSource basic scaffolding for this using RxJS? ( I mean the basic bang like NgRx ).

DDD -> NgRx
- Command -> Action ( in imperative )
- Command Handler -> Effect
- Domain Event -> Action ( in past tense )
- Aggregate state -> a Store entry
- Aggregate state's apply -> Reducer

Did I get this right?

Having worked with in-depth for 2 years now, I can articulate what I don’t like about the .

1. is a terrible primitive to build most software upon. are better for most things, and event listeners are fine.

2. Its system encourages long-lived, easily-accessible Singletons that are serious “foot guns.”

3. Data management is painful. Resolvers are a worse DX than either ’s Ember Data or ’s TanStack Query.

Continued thread

Since it's related, here's the `removeEventListener` API I wish we had:

```javascript
const removeListener = window.addEventListener('something', () => { /* ... */ });

await someTime();

removeListener();
```

Benefits:
1. You only provide the handler once, so it works great with lambdas. You don't need to keep a reference to the handler just to remove it later.
2. You don't need to provide the event twice. It's additional information to hard-code and/or dynamically track.
3. You can't accidentally `removeEventListener` on a function which was not bound in the first place (which is a no-op that often indicates a bug such as `removeEventListener('something', foo.bind(this)`).

This design is basically a copy of the way #RxJS handles subscriptions, but I find this much more ergonomic and intuitive.

#rxjs created an industry, a massive enterprise in wondering if observables need to be unsubscribed. I think the anti-unsubscription crowd is right in the sense of
- We don't know what is happening in unsubscribe(), maybe nothing
- The computer will be shut down, we will all die, and the universe will be cold and black and so should we really care about collecting the garbage early
- Out-of-memory will force garbage collection organically as the user reboots.

stackoverflow.com/questions/38

Stack OverflowAngular/RxJS When should I unsubscribe from `Subscription`When should I store the Subscription instances and invoke unsubscribe() during the ngOnDestroy life cycle and when can I simply ignore them? Saving all subscriptions introduces a lot of mess into

Interesting conversation on the @TC39 AsyncIterator helpers spec about the behavior of flatMap and it’s resolution strategy. There’s a reason IxJS and RxJS have concatMap and flatMap to limit the concurrency. It’ll be interesting how this plays out github.com/tc39/proposal-async

GitHubPrior art for this kind of concurrency in other languages · Issue #2 · tc39/proposal-async-iterator-helpersBy bakkot

It's kind of sad to see articles like this not quite getting the essence of RxJS and Observables. They are a primitive that could be used to build other things like Signals. Knockout.js was built on this idea of Observables as well, hence the name ko.observable

Plenty of ways to handle the mass unsubscribe either through combinators such as takeUntil or managing it yourself with subscriptions/disposables

builder.io/blog/history-of-rea

Builder.ioA Brief History of ReactivityIn this post, Miško tells the story of his personal journey and takes about the history of reactivity along different frameworks.

One thing I regretted when I created RxJS that I didn't create a more simple lightweight primitive that could be used for binding scenarios such as what we saw in Knockout.js and now in Signals. It could have just been a BehaviorSubject with composition operators that returned BehaviorSubjects instead of just Observables.

I am intrigued though where the reactive future does take us

@Perl @gandalf’s RxPerl will cure what ails you, if what ails you is dealing with streams of data via asynchronous callback functions. metacpan.org/pod/RxPerl

You can drop it into your existing event-driven #Perl code with ease, as it works with @leonerd’s IO::Async, @mojolicious’s Mojo::IOLoop, and AnyEvent interface libraries. It’s an implementation of #ReactiveX designed to behave like #JavaScript’s #RxJS. noc.social/@gandalf/1098396707

metacpan.orgRxPerl - an implementation of Reactive Extensions / rxjs for Perl - metacpan.organ implementation of Reactive Extensions / rxjs for Perl