-
-
Save oroce/ec3786ba7eff59963842220c3ffc56b4 to your computer and use it in GitHub Desktop.
Load Raven async
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function (window, document, script, raven, el, first, loaded) { | |
raven = []; | |
window.onerror = function e(message, file, line, colno, ex) { | |
if (loaded) { | |
return; | |
} | |
raven.push([message, file, colno, ex]); | |
}; | |
el = document.createElement(script); | |
first = document.getElementsByTagName(script)[0]; | |
el.src = 'https://cdn.ravenjs.com/3.7.0/raven.min.js'; | |
el.onreadystatechange = el.onload = function() { | |
if (loaded) { | |
return; | |
} | |
loaded = true; | |
Raven.config('<DSN>', { | |
release: '<VERSION>', | |
}).install(); | |
for (var i = 0; i < raven.length; i++) { | |
var entry = raven[i]; | |
Raven.captureException(entry[4] || new Error(entry[0]), { | |
extra: { | |
file: entry[1], | |
lineno: entry[2], | |
colno: entry[3] | |
} | |
}); | |
} | |
}; | |
first.parentNode.insertBefore(el, first); | |
})(window, document, 'script'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
at this point the biggest help would be having
traceKitWindowOnError
as an exported function from raven, so something like could be done: