Re:A proposal to add signals to JavaScript
by kabes on Sunday March 31, 2024 @05:55PM
(#39888419)
Signals are also just pub/sub, but with a more ergonomic api. More ergonomic because listeners are added and released automatically.
It can also be more performant, eg, say you have a computation that depends on 2 values:
`result = a ? b : 0`
Then if a is falsy, we don't need to recompute if b changes. This is achieved automatically with signals, but would require quite some code with classic pub/sub.
It can also be more performant, eg, say you have a computation that depends on 2 values:
`result = a ? b : 0`
Then if a is falsy, we don't need to recompute if b changes. This is achieved automatically with signals, but would require quite some code with classic pub/sub.