Hey frontend devs. Are signals just a kind of event emitter?

@mauve no I mean “reactive signals”, it’s a trendy new front end pattern

@heapwolf Ha ha, are we going to get another wave of rxjs type hype? Personally I loved that era.

@mauve seems possible. I guess I’m going to have to code read an implementation of signals to find out if it’s just an event emitter, there are 100000 tuts on how to use them, and none of them say specifically how signals work 😅

@heapwolf @mauve let's go back to backbone apps with control flow via global pubsub 🙈

@naugtur @heapwolf LMAO. In all seriousness I've gone back to putting ID's everywhere and ".addEventListener" on buttons.

It's like the joy of simpler times. TBH I miss adding jquery and hoping for the best.

@mauve @heapwolf I recently wanted to make a PoC of an idea and I wrote my own minimal jQuery for the front and express router for the back. Zero dependencies, lots of joy. github.com/naugtur/timely-tuto

@naugtur @heapwolf Oh wow I love seeing WeakMap's being used in the wild. It's just so nice that they exist now specifically for nice stuff like this.

I like how straightforward the router declaration is. Just shove em in there and it handles the rest.

Ty for the link 🙇

@mauve @heapwolf it surprised me how little I needed to do to get convenience on top of default http module.

I remember my pal wrote a minimal react like renderer that didn't diff but flush everything and it was 1kb 🙂

@heapwolf @mauve I understood them so far to be more like observerables, which yeah do appear in rxjs, but have existed in various forms for many years (I remember writing an implementation back in 2012, based on Dojo Toolkit's implementation)

@thisismissem @mauve what’s the difference between an observable and an event emitter?

@heapwolf @thisismissem I see event emitter as being similar to an EventTarget in that it's a bag of events and the thing is a bit more central. I think observables feel more lightweight like a single variable and is easier for them to be passed around as variables and combined

@heapwolf @thisismissem I assume this current wave is a reaction to React's useHook API, and a thing that ropes things into one place again (like redux and "stores"

@heapwolf @mauve an eventemitter doesn't store a value, an observable does, afaik. So an observable could implement an event emitters interface if it wanted but the main event is a "change" event

@thisismissem @mauve that definitely clear to me now, thank you! :) it would be cool to see someone write a post on this pattern, it seems pretty simple, like you don’t really need a library for it.

Sign in to participate in the conversation
Mauvestodon

Escape ship from centralized social media run by Mauve.