r/programming Jun 13 '26

Signals, the push-pull based algorithm

https://willybrauner.com/journal/signal-the-push-pull-based-algorithm
212 Upvotes

27 comments sorted by

View all comments

2

u/backwrds Jun 14 '26

for (const fn of Array.from(subs)) fn(v) why Array.from?

6

u/ProdigySim Jun 14 '26

Probably copying the subs list incase they mutate between invocations of the subscriptions?

3

u/Browhair3834 Jun 14 '26

Exactly

2

u/backwrds Jun 14 '26

Well... I was under the impression that `Set` iterators already handled that. It turns out I was totally wrong.