From 680b4aa107cb8ff1493f74f0034abc8813fb6d9e Mon Sep 17 00:00:00 2001 From: Pieter de Bie Date: Tue, 26 Feb 2013 11:18:38 +0100 Subject: [PATCH] Make it optional to wrap jQuery or async callbacks --- tracekit.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tracekit.js b/tracekit.js index 0380b1f..1dd7113 100644 --- a/tracekit.js +++ b/tracekit.js @@ -1058,7 +1058,8 @@ TraceKit.computeStackTrace = (function computeStackTraceWrapper() { * Extends support for global error handling for asynchronous browser * functions. Adopted from Closure Library's errorhandler.js */ -(function extendToAsynchronousCallbacks() { +TraceKit.wrapAsyncCallbacks = function () +{ var _helper = function _helper(fnName) { var originalFn = window[fnName]; window[fnName] = function traceKitAsyncExtension() { @@ -1081,13 +1082,15 @@ TraceKit.computeStackTrace = (function computeStackTraceWrapper() { _helper('setTimeout'); _helper('setInterval'); -}()); +}; /** * Extended support for backtraces and global error handling for most * asynchronous jQuery functions. */ -(function traceKitAsyncForjQuery($) { +TraceKit.wrapJQuery = function () +{ + var $ = window.jQuery; // quit if jQuery isn't on the page if (!$) { @@ -1141,8 +1144,7 @@ TraceKit.computeStackTrace = (function computeStackTraceWrapper() { throw e; } }; - -}(window.jQuery)); +}; //Default options: if (!TraceKit.remoteFetching) {