kevinbarabash / live-proxy

Live reloading for JavaScript + sand boxing.
http://kevinbarabash.github.io/live-proxy/
3 stars 0 forks source link

optimize try-catch blocks #13

Closed kevinbarabash closed 8 years ago

kevinbarabash commented 8 years ago

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.

kevinbarabash commented 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.

kevinbarabash commented 8 years ago

Implemented for processing event handlers and draw in https://github.com/kevinbarabash/live-proxy/commit/6ebfe8d0d22b0bc8444081001732d59131d1aa5f.

kevinbarabash commented 8 years ago

handleUpdate has also been optimized.