4 ms·
About events: a nice trick is to add event listeners to the window only and check the event.target. This method is used in game dev a lot.
by ohwp 13y ago
About events: a nice trick is to add event listeners to the window only and check the event.target.
This method is used in game dev a lot.
- tracker1 13y ago+1 where it makes sense.. however this doesn't work well with a modular application, and could lead to a lot of higher level handlers/listeners. I think the more expensive cost is cleanup, or lack of proper cleanup leading to memory leaks... I'll usually detach nodes to cleanup, and put them into a queue that's run in a setTimeout loop... that way they don't slow down the UI.