Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
client-side error beacon code in coffeescript
class YourNamespace.Errors
window.onerror = (e) => @report(e)
@report: (e) ->
img = new Image(1,1)
img.src = '//' + your_config.errors_host + '/images/error_pixel.gif'
img.style.display='none'
document.getElementsByTagName('body')[0].appendChild(img);
@eanakashima

This comment has been minimized.

Copy link
Owner Author

commented Dec 10, 2013

Just a sketch. You may also want to check if window.onerror has already been set, since other code or third-party tools may already have set a handler there, and call that function as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.