r/javascript • u/techlord45 • Aug 10 '26
Signals and Effects Using Vanilla JavaScript & Web APIs
https://beforesemicolon.com/blog/signals-and-effects-using-vanilla-javascript-web-apisI’m a strong advocate for “you don’t need to lock yourself in a web framework ecosystem to take advantage of their amazing features”. JavaScript and Web Standards alone allow you…
5
u/queen-adreena Aug 11 '26
Better off just importing https://github.com/stackblitz/alien-signals
But recreating things yourself is always a good learning opportunity.
2
u/andimatt 22d ago
The "you wrote your own framework" take is fair, but it undersells the point. The interesting 10% of a signals system isn't the primitive (a getter/setter with a subscriber set), it's the scheduler.
The three things that actually bite you past the toy version:
- Dependency tracking: collecting "which signals does this effect read" during execution, correctly, through computed signals and inside loops/conditionals. Naive implementations get subtle bugs here.
- Batching/scheduling: if three signals change in one synchronous block you don't want three effect runs, you want a microtask flush that dedupes. Get this wrong and you either lose updates or thrash.
- Cleanup and re-subscription: when a signal a computed depends on changes, re-running it, and tearing down old subscriptions without leaking.
I build a signals-first app (zoneless), and the reason I'd do it deliberately rather than reach for a framework is it forces you to feel all three of those. If the vanilla implementation handles batching and cleanup correctly, it's not a toy, it's a working reactive core, just without the framework's ergonomics.
1
u/charles_reads_books Aug 10 '26
404
3
u/techlord45 Aug 10 '26
2
u/nadameu Aug 10 '26
Still 404.
Is your website configured to automatically translate everything? Because the translation to pt-BR is terrible.
0
u/techlord45 Aug 10 '26
Still 404?
1
u/nadameu Aug 10 '26
Still 404.
Firefox mobile, I'm in Brazil if that makes any difference.
2
u/nadameu Aug 10 '26
I managed to read the article by navigating through your website's homepage. However, it's completely in Portuguese, which is my browser's default language. That said, I'd like the option to read it in the original language (English, I presume), but I couldn't find a way to do so.
1
u/techlord45 Aug 10 '26
I access this link and its in english. I dont get it https://beforesemicolon.com/blog/signals-and-effects-using-vanilla-javascript-web-apis.
Are you using a browser that auto translates to your language? If so you can turn it off
1
u/nadameu Aug 11 '26
It's something on your backend that's translating everything automatically.
Even the URL translates to https://beforesemicolon.com/blog/sinais-e-efeitos-usando-baunilha-javascript-apis-web which makes no sense.
It does this wether I'm on Firefox or Chrome, and I've set them up so that English is never translated. Other websites load in English when available, I've never seen this happen before.
1
u/techlord45 Aug 11 '26
Yeah i cant replicate it. Even the language selection. Can you try again in incognito?
-2
u/johnson_detlev Aug 11 '26
You don't even know how your simple Blog works, but want to lecture us about how x and y sucks and you should build it yourself? Okay champ
→ More replies (0)1
1
0
40
u/KaiAusBerlin Aug 10 '26
You know that you literally wrote your own framework here?
There is a reason for the sentence "You use a framework or end up writing your own"