Last active
March 13, 2019 13:41
-
-
Save karolisdzeja/8010574 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(w){ | |
if (typeof Raven == 'undefined') { | |
w._r = w._r || []; | |
w.onerror = function e(msg, url, ln) { | |
w._r.push([msg, url, ln]); | |
} | |
} | |
})(window) | |
function loadJS(src, callback) { | |
var script = document.createElement('script'), | |
loaded; | |
script.setAttribute('src', src); | |
if (callback) { | |
script.onreadystatechange = script.onload = function() { | |
if (!loaded) { | |
callback(); | |
} | |
loaded = true; | |
}; | |
} | |
document.getElementsByTagName('head')[0].appendChild(script); | |
} | |
loadJS("//d3nslu0hdya83q.cloudfront.net/dist/1.0/raven.min.js", function() { | |
Raven.config('//url').install(); | |
_r = _r || []; | |
for (var i = 0; i < _r.length; i++) { | |
Raven.captureMessage('Message: ' + _r[i][0] + ' - URL: ' + _r[i][1] + ' - Line: ' + _r[i][2]) | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment