What's the best way to implement this:
I have multiple elements that will need to do some sort of calculations whenever a global event happens (ex. resize, scroll).
I can either
- Add each element to an array then have a single listener for the event and whenever it happens, run a handler that takes the array and loop through each to perform its calc
or
- Have each element listen to the single global event
Is there any methods I'm missing?