Created
March 14, 2011 11:41
-
-
Save latentflip/869029 to your computer and use it in GitHub Desktop.
There may be a better way to do this, but: When writing JS I often make a silly little typo or something that I don't notice unless I:
- notice that something seems broken
- open Chrome's developer toolbar, which I inevitably closed last time to get
This file contains hidden or 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
-if RAILS_ENV == 'development' | |
:javascript | |
$(function() { | |
var notify = function(icon, title, body) { | |
if (window.webkitNotifications.checkPermission() == 0) { | |
var popup = window.webkitNotifications.createNotification( | |
icon, title, body); | |
popup.show(); | |
return true; | |
} | |
} | |
//Bind the popup to window.onerror | |
window.onerror = function(str, url, line) { | |
notify("", "JS Error", str+'\n'+url+':'+line); | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment