r/javascript • • Apr 16 '24

JavaScript Signals standard proposal

https://github.com/proposal-signals/proposal-signals
6 Upvotes

19 comments sorted by

View all comments

2

u/shgysk8zer0 Apr 16 '24

I'm familiar with the proposal since before it advanced to stage 1. Seems pretty useful for a specific set of things that many devs don't worry about unless they're working on a framework or are thinking like engineers (basically thinking about complexity and efficiency). But the proposal is basically a way of momoization and lazy evaluation... Which can be pretty awesome when you need it.

For example, let's suppose you had a simple one for some URL and a derived one (I forget the term... "computed"?) for a response upon fetch()ing that URL. This would allow reuse of the same response up until the URL is changed.... Almost magically!