But there's no need to wrap every function, just the ones that can be top-level entry points. It's a very small list, if your application is well-designed.
Patch setTimeout and setInterval. Register a jQuery ajax prefilter that wraps all your ajax callbacks. Patch jQuery's low-level UI event binding function.
And you're done. I've done this in a rather large application. It works fine.
Fair enough. I guess that's the pure js/jquery version of hooking into Angular/Ember's onerror. Makes sense. At least we won't need to do this for much longer though.
Patch setTimeout and setInterval. Register a jQuery ajax prefilter that wraps all your ajax callbacks. Patch jQuery's low-level UI event binding function.
And you're done. I've done this in a rather large application. It works fine.