Created
March 14, 2011 11:42
-
-
Save latentflip/869030 to your computer and use it in GitHub Desktop.
Gives a growl like popup if a page has an error. Useful under development.
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
Good idea, I might just do that. Thanks.