tc39 / proposal-signals

A proposal to add signals to JavaScript.
MIT License
2.95k stars 54 forks source link

Generalise the `notifying` semantics to `freezing` #223

Closed prophile closed 4 days ago

prophile commented 2 weeks ago

There are a couple of other cases where having the signal graph be frozen avoids some hard-to-specify and hard-to-reason-about behaviours, like calling .unwatch within a watched callback. Here we generalise the notifying trap to a general "freeze the signal graph" mechanism and use it to protect unwatched and watched callbacks.

As discussed in the community call 2024-05-12.

Fixes #211 Fixes #206

Thoughts?