Skip to content

Commit

Permalink
Drop jQuery support
Browse files Browse the repository at this point in the history
In my opinion, this is too opinionated for something like TraceKit. TraceKit is a great library that provides functionality for other ligher levels libs to utilize.

With my recent commit of TraceKit.wrap(), that kind of paves the way for others to use it in a way to wrap anything they want. In the case for us (raven-js), I'm going to be providing a bunch of plugins to patch common libs that a user can pick and choose from. I'd rather not include source for jQuery for someone who isn't using jQuery.

I hope this makes sense. If anything, document the code that was removed and include it as a separate file so it still exists, but isn't so tightly coupled.
  • Loading branch information
mattrobenolt committed Feb 13, 2013
1 parent 2aabd7b commit 487354f
Showing 1 changed file with 0 additions and 112 deletions.
112 changes: 0 additions & 112 deletions tracekit.js
Expand Up @@ -1064,118 +1064,6 @@ TraceKit.computeStackTrace = (function computeStackTraceWrapper() {
_helper('setInterval');
}(window));

/**
* Extended support for backtraces and global error handling for most
* asynchronous jQuery functions.
*/
(function traceKitAsyncForjQuery($) {

// quit if jQuery isn't on the page
if (!$) {
return;
}

var _oldEventAdd = $.event.add;
$.event.add = function traceKitEventAdd(elem, types, handler, data, selector) {
var _handler;

if (handler.handler) {
_handler = handler.handler;
handler.handler = function traceKitHandler() {
try {
return _handler.apply(this, arguments);
} catch (e) {
TraceKit.report(e);
throw e;
}
};
} else {
_handler = handler;
handler = function apply_handler() {
try {
return _handler.apply(this, arguments);
} catch (e) {
TraceKit.report(e);
throw e;
}
};
}

// If the handler we are attaching doesn’t have the same guid as
// the original, it will never be removed when someone tries to
// unbind the original function later. Technically as a result of
// this our guids are no longer globally unique, but whatever, that
// never hurt anybody RIGHT?!
if (_handler.guid) {
handler.guid = _handler.guid;
} else {
handler.guid = _handler.guid = $.guid++;
}

return _oldEventAdd.call(this, elem, types, handler, data, selector);
};

var _oldReady = $.fn.ready;
$.fn.ready = function traceKitjQueryReadyWrapper(fn) {
var _fn = function () {
try {
return fn.apply(this, arguments);
} catch (e) {
TraceKit.report(e);
throw e;
}
};

return _oldReady.call(this, _fn);
};

var _oldAjax = $.ajax;
$.ajax = function traceKitAjaxWrapper(s) {
if ($.isFunction(s.complete)) {
var _oldComplete = s.complete;
s.complete = function traceKitjQueryComplete() {
try {
return _oldComplete.apply(this, arguments);
} catch (e) {
TraceKit.report(e);
throw e;
}
};
}

if ($.isFunction(s.error)) {
var _oldError = s.error;
s.error = function traceKitjQueryError() {
try {
return _oldError.apply(this, arguments);
} catch (e) {
TraceKit.report(e);
throw e;
}
};
}

if ($.isFunction(s.success)) {
var _oldSuccess = s.success;
s.success = function traceKitjQuerySuccess() {
try {
return _oldSuccess.apply(this, arguments);
} catch (e) {
TraceKit.report(e);
throw e;
}
};
}

try {
return _oldAjax.call(this, s);
} catch (e) {
TraceKit.report(e);
throw e;
}
};

}(window.jQuery));

//Default options:
if (!TraceKit.remoteFetching) {
Expand Down

0 comments on commit 487354f

Please sign in to comment.