Closed kevinbarabash closed 8 years ago
Only add try-catches to functions we know are asynchronous, e.g. setTimeout
, setInterval
, requestAnimationFrame
, and all of the processing function event handlers and draw
.
Implemented for processing event handlers and draw
in https://github.com/kevinbarabash/live-proxy/commit/6ebfe8d0d22b0bc8444081001732d59131d1aa5f.
handleUpdate
has also been optimized.
For processing-js we can wrap all callback functions in function that calls the original inside a try-catch. Apparently calling a single function that does a lot of stuff inside a try-catch is better that simply doing a lot of stuff inside a try catch.
More generally, functions being passed as callbacks could be wrapped using an IIFE.